You are here

function filebrowser_form_upload in Filebrowser 8

Same name and namespace in other branches
  1. 6.2 filebrowser.form.upload.inc \filebrowser_form_upload()
  2. 7.4 filebrowser.module \filebrowser_form_upload()
  3. 7.2 filebrowser.module \filebrowser_form_upload()
  4. 7.3 filebrowser.module \filebrowser_form_upload()

upload form definition.

1 string reference to 'filebrowser_form_upload'
filebrowser_view_D7_BAK in ./filebrowser.module
Implements hook_init().

File

./filebrowser.module, line 479
Validates file path input on node form

Code

function filebrowser_form_upload($form, &$form_state, $node) {
  $form = array();
  $form['filebrowser_uploads'] = array(
    '#type' => 'fieldset',
    '#title' => t('File Upload'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#description' => t('Uploaded file will be saved to the current directory.'),
    '#prefix' => '<div class="attachments">',
    '#suffix' => '</div>',
    '#weight' => 30,
  );

  // Wrapper for fieldset contents (used by ahah.js).

  /*      $form['filebrowser_uploads']['wrapper'] = array(
          '#prefix' => '<div id="attach-wrapper">',
          '#suffix' => '</div>',
        '#type'=>'textfield'

        );*/
  $form['node'] = array(
    '#type' => 'value',
    '#value' => $node,
  );
  $form['#attributes'] = array(
    'enctype' => "multipart/form-data",
  );
  _filebrowser_load_files($node);
  $form['#submit'][] = 'filebrowser_form_upload_submit';
  $form['#validate'][] = 'filebrowser_form_upload_validate';
  $i = 1;

  // Later we can have multi-upload
  $form['filebrowser_uploads']["file_{$i}"] = array(
    '#type' => 'file',
    '#title' => t('Upload file'),
    '#size' => 40,
  );
  $form['filebrowser_uploads']["description_{$i}"] = array(
    '#type' => 'textarea',
    '#title' => t('Description'),
    '#size' => 255,
  );
  $form['filebrowser_uploads']["file_name_{$i}"] = array(
    '#type' => 'textfield',
    '#description' => t('Just put filename with NO EXTENSION here if you want to rename the file you want to upload'),
    '#title' => t('New name'),
    '#size' => 40,
  );
  $form['submitted'] = array(
    '#tree' => TRUE,
  );
  $form['filebrowser_uploads']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Upload'),
  );
  $form['#redirect'] = NULL;
  return $form;
}