hello,
I am making a contact form using the input=“file” tag.
How can I do it if I want to upload files in pdf and multiple formats?
I want to be able to upload pdf, jpg, png, hwp, docx, etc. files together.
controllers - contact.php
elseif ($upload['type'] !== 'application/pdf') {
$alerts[] = $upload['name'] . ' is not a PDF';
// all valid, try to rename the temporary file
} else {
$name = $upload['tmp_name'];
$tmpName = pathinfo($name);
// sanitize the original filename
$filename = $tmpName['dirname']. '/'. F::safeName($upload['name']);
if (rename($upload['tmp_name'], $filename)) {
$name = $filename;
}
// add the files to the attachments array
$attachments[] = $name;
}