I have this code
if(isset($_FILES['uploadfile']))
{
$maxsize = 10485760; //10MBx1024
$acceptable = array(
'image/jpeg',
'image/jpg',
'image/gif',
'image/png',
'application/pdf',
'text/plain',
'application/vnd.ms-excel',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'application/vnd.ms-word',
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'application/zip',
'application/x-zip-compressed',
'application/x-compressed',
);
and this is the following parts:
if((!in_array($_FILES['uploadfile']['type'], $acceptable)) && (!empty($_FILES["uploadfile"]["type"])))
{
$msg= "<b><img src=redwarn.png'><font color='red'> This file is not accepted.</b></font>";
goto cancel;
}
The above code could limit the extension that user upload, but I tried to upload a IMAGE file, it come out an error that the file wasn't accepted, but I did add 'image/jpeg'
in the array, is there any error in my code?
Thanks