I have 5 upload file fields… I need it to check through the 5 files and make sure that they are all .jpg files… If any of the 5 files are different extensions, then populate $error_msg.
Been trying with code bellow, but it seems to let the form submit the files are mixed say jpg and png…
$allowedExtensions = array("jpg","jpeg","pjpeg");
foreach ($_FILES['photoname'] as $file) {
if ($file['tmp_name'] > '') {
if (!in_array(end(explode(".",
strtolower($file['name']))),
$allowedExtensions)) {
$error_msg = 'File type not allowed';
}
}
}