You are here

function filebrowser_form_plupload_upload in Filebrowser 7.4

upload form using plupload @inheritdoc

1 string reference to 'filebrowser_form_plupload_upload'
filebrowser_view in ./filebrowser.module
Implements hook_init(). @inheritdoc

File

./filebrowser.module, line 622

Code

function filebrowser_form_plupload_upload($form, &$form_state, $node) {
  $filter = _filebrowser_pattern_to_filter($node->folder_uploads->accepted_uploaded_files);
  $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'] = array(
    '#type' => 'value',
    '#value' => $node,
  );
  $form['#attributes'] = array(
    'enctype' => "multipart/form-data",
  );
  _filebrowser_load_files($node);
  $form['filebrowser_uploads']['file'] = array(
    '#type' => 'plupload',
    '#title' => t('Upload file'),
    '#size' => 40,
    '#plupload_settings' => array(
      'runtimes' => 'html5',
      'chunk_size' => '1mb',
    ),
    '#upload_validators' => array(
      'file_validate_extensions' => array(
        $filter,
      ),
    ),
  );
  $form['submitted'] = array(
    '#tree' => TRUE,
  );
  $form['filebrowser_uploads']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Upload'),
  );
  $form['#redirect'] = NULL;
  return $form;
}