function block_upload_form_validate in Block Upload 7
Validate and save uploaded file.
File
- ./
block_upload.module, line 278 - Block Upload module.
Code
function block_upload_form_validate($form, &$form_state) {
$values = $form_state['values'];
if (!empty($values['block_upload_file'])) {
$buid = $values['buid'];
$field_name = variable_get('block_upload_' . $buid . '_field', '');
$field = field_info_instance('node', $field_name, $values['block_upload_node_type']);
$file = file_load($form_state['values']['block_upload_file']);
$file->status = FILE_STATUS_PERMANENT;
if ($field['widget']['module'] == 'file') {
$file->display = 1;
}
$file = file_save($file);
$form_state['storage']['file'] = $file;
}
}