You are here

function vsf_upload_form in Visual select file 7

Upload form.

2 string references to 'vsf_upload_form'
vsf_upload_menu in submodules/vsf_upload/vsf_upload.module
Implements hook_menu().
vsf_upload_preprocess_views_view in submodules/vsf_upload/vsf_upload.module
Implements hook_preprocess_views_view().

File

submodules/vsf_upload/vsf_upload.module, line 73

Code

function vsf_upload_form($form, &$form_state) {
  $form['upload'] = array(
    '#type' => 'fieldset',
    '#title' => t('Upload a file'),
    '#collapsed' => current_path() != 'file/add',
    '#collapsible' => current_path() != 'file/add',
  );
  $form['upload']['file'] = array(
    '#title' => t('File'),
    '#type' => 'managed_file',
    '#required' => TRUE,
    '#upload_location' => variable_get('vsf_upload_scheme', VSF_DEFAULT_UPLOAD_SCHEME) . '://' . variable_get('vsf_upload_location', VSF_DEFAULT_UPLOAD_LOCATION),
    '#upload_validators' => array(
      'file_validate_extensions' => array(
        variable_get('vsf_upload_extensions', VSF_DEFAULT_UPLOAD_EXTENSIONS),
      ),
      'file_validate_size' => array(
        parse_size(variable_get('vsf_upload_size', VSF_DEFAULT_UPLOAD_FILE_SIZE)),
      ),
    ),
    '#process' => array(
      'vsf_upload_file_element_process',
    ),
    '#description' => t('The maximum file size is: %file_size, the allowed file extensions are: %file_extensions.', array(
      '%file_extensions' => variable_get('vsf_upload_extensions', VSF_DEFAULT_UPLOAD_EXTENSIONS),
      '%file_size' => format_size(parse_size(variable_get('vsf_upload_size', VSF_DEFAULT_UPLOAD_FILE_SIZE))),
    )),
  );
  $form['upload']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Upload'),
    '#submit' => array(
      'vsf_upload_form_submit',
    ),
  );
  return $form;
}