fileupload_validate
- Versions
- 4.6 – 5
fileupload_validate(&$node)
Implementation of hook_validate().
Verify that there is a file attached to the node.
Code
developer/examples/fileupload.module, line 162
<?php
function fileupload_validate(&$node) {
// Check for a new file upload.
if ($file = file_check_upload('file')) {
$node->file = $file;
}
// Make sure there is an upload or an existing file.
if (!$file && !file_exists($node->current_file)) {
form_set_error('file', t('A file must be provided.'));
}
}
?>Login or register to post comments 