You are here

function filebrowser_form_upload_validate in Filebrowser 7.4

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

uploads validation.

File

./filebrowser.module, line 672

Code

function filebrowser_form_upload_validate($form, &$form_state) {
  $node = $form_state['values']['node'];
  _filebrowser_load_files($node);
  $target = _filebrowser_build_new_upload_file_name($node, $form_state);
  if (!$node->folder_uploads->allow_overwrite && file_exists($target)) {
    form_error($form['filebrowser_uploads']["file"], 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"], t("Sorry, you can't upload this kind of file."));
  }
}