I have some php code checking the type of files that users upload:
$fileType = $_FILES['file']['type'];
$allowedFileTypes = array('image/jpeg','image/gif','image/png','image/jpg');
if(!in_array($fileType, $allowedFileTypes)) {echo 'fileTypeNotAllowed'; exit;}
I find gif & png files upload without triggering the echo but jpg files trigger the echo.
below is an example of a file that triggers the echo:
Any advise on what I'm doing wrong here?
thx
echo 'fileTypeNotAllowed: '.$fileType;
– Green Black!in_array(strtolower($fileType, $allowedFileTypes))
.in_array
is case sensitive. – Baylor Rae'