You are here

function filebrowser_form_upload_validate in Filebrowser 6.2

Same name and namespace in other branches
  1. 8 filebrowser.module \filebrowser_form_upload_validate()
  2. 7.4 filebrowser.module \filebrowser_form_upload_validate()
  3. 7.2 filebrowser.module \filebrowser_form_upload_validate()
  4. 7.3 filebrowser.module \filebrowser_form_upload_validate()

uploads validation.

1 string reference to 'filebrowser_form_upload_validate'
filebrowser_form_upload in ./filebrowser.form.upload.inc
upload form definition.

File

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

Code

function filebrowser_form_upload_validate($form, $form_state) {
  $node = $form['#node'];
  _filebrowser_load_files($node);
  $i = 1;

  // Later we can have multi-upload
  $target = _filebrowser_build_new_upload_file_name($node, $form_state, $i);
  if (!$node->folder_uploads->allow_overwrite && file_exists($target)) {
    form_error($form['filebrowser_uploads']["file_{$i}"], t("This file already exists."));
  }
  if (!empty($node->folder_uploads->accepted_uploaded_files) && !_filebrowser_match_path($target, $node->folder_uploads->accepted_uploaded_files)) {
    form_error($form['filebrowser_uploads']["file_{$i}"], t("Sorry, you can't upload this kind of file."));
  }
}