function filebrowser_form_upload_validate in Filebrowser 7.2
Same name and namespace in other branches
- 8 filebrowser.module \filebrowser_form_upload_validate()
- 6.2 filebrowser.form.upload.inc \filebrowser_form_upload_validate()
- 7.4 filebrowser.module \filebrowser_form_upload_validate()
- 7.3 filebrowser.module \filebrowser_form_upload_validate()
uploads validation.
1 string reference to 'filebrowser_form_upload_validate'
- filebrowser_form_upload in ./
filebrowser.module - upload form definition.
File
- ./
filebrowser.module, line 604
Code
function filebrowser_form_upload_validate($form, &$form_state) {
$node = $form_state['values']['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."));
}
}