function uc_file_admin_files_form_action_validate in Ubercart 7.3
Same name and namespace in other branches
- 6.2 uc_file/uc_file.admin.inc \uc_file_admin_files_form_action_validate()
Validation handler for uc_file_admin_files_form_action().
See also
uc_file_admin_files_form_action()
uc_file_admin_files_form_action_submit()
1 string reference to 'uc_file_admin_files_form_action_validate'
- uc_file_admin_files_form in uc_file/
uc_file.admin.inc - Form builder for file products admin.
File
- uc_file/
uc_file.admin.inc, line 370 - File administration menu items.
Code
function uc_file_admin_files_form_action_validate($form, &$form_state) {
switch ($form_state['values']['action']) {
case 'uc_file_upload':
// Upload the file and get its object.
if ($temp_file = file_save_upload('upload', array(
'file_validate_extensions' => array(),
))) {
// Check if any hook_uc_file_action('upload_validate', $args)
// are implemented.
foreach (module_implements('uc_file_action') as $module) {
$name = $module . '_uc_file_action';
$result = $name('upload_validate', array(
'file_object' => $temp_file,
'form_id' => $form_id,
'form_state' => $form_state,
));
}
// Save the uploaded file for later processing.
$form_state['storage']['temp_file'] = $temp_file;
}
else {
form_set_error('', t('An error occurred while uploading the file'));
}
break;
default:
// This action isn't handled by us, so check if any
// hook_uc_file_action('validate', $args) are implemented.
foreach (module_implements('uc_file_action') as $module) {
$name = $module . '_uc_file_action';
$result = $name('validate', array(
'form_id' => $form_id,
'form_state' => $form_state,
));
}
break;
}
}