function fillpdf_forms_validate in FillPDF 6
Makes sure the Upload was provided (want to validate .pdf here too)
File
- ./
fillpdf.admin.inc, line 166 - Allows mappings of PDFs to site content
Code
function fillpdf_forms_validate($form, &$form_state) {
// uploading anything?
$file = $_FILES['files']['name']['upload_pdf'];
if (!$file) {
form_set_error('url', t('A PDF must be provided.'));
}
//from includes/file.inc, line 634, but can't use that function because file not an object yet
if (!preg_match('/\\.pdf$/i', $file)) {
form_set_error('url', t('Only PDF files are allowed'));
}
// directory exist or writeable?
$dir = file_directory_path() . "/fillpdf";
file_check_directory($dir, FILE_CREATE_DIRECTORY, 'url');
}