Reputation: 79
I am using below code for file upload but it do not work in case of doc and excel file
switch(strtolower($ImageType))
{
case 'image/png':
case 'image/gif':
case 'application/pdf':
case 'image/jpeg':
case 'video/avi':
case 'video/mp4':
case 'image/pjpeg':
case 'application/msword':
case 'application/vnd.ms-excel':
break;
default:
die('Unsupported File!'); //output error and exit
}
this code work i case of image but when we upload doc file. it show me unsupported file
Upvotes: 1
Views: 1909
Reputation:
You are probably missing additional MIME types. Your MIME types are correct for older .doc and .xls files, but not for newer ones.
For .xlsx files use:
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
For .docx files use:
application/vnd.openxmlformats-officedocument.wordprocessingml.document
This might help you as well:
Upvotes: 2