fileupload_validate
developer/examples/fileupload.module, строка 162
- Версии
- 5
fileupload_validate(&$node)
Implementation of hook_validate()
.
Verify that there is a file attached to the node.
Код
<?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.'));
}
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии