You are here

function filebrowser_form_upload in Filebrowser 6.2

Same name and namespace in other branches
  1. 8 filebrowser.module \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 in ./filebrowser.module
Implementation of hook_init().

File

./filebrowser.form.upload.inc, line 48

Code

function filebrowser_form_upload($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,
  );
  $form['#node'] = $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;
}