I am using Excel to save a spreadsheet in .csv format. This creates a
text file with extension .csv
But when I try to upload the file to the server by checking for its
MIME type using $_FILE['userfile']['type'] I get my own error message
that the file is not text file. If I change the extension to .txt I am
able to upload the file.
This is not reliable as it is only relying on extensions rather than
contents of the file. Is there a reliable way of checking for file
formats. I would like to upload jpeg, gif and text files reliably.
Thank you
John
text file with extension .csv
But when I try to upload the file to the server by checking for its
MIME type using $_FILE['userfile']['type'] I get my own error message
that the file is not text file. If I change the extension to .txt I am
able to upload the file.
This is not reliable as it is only relying on extensions rather than
contents of the file. Is there a reliable way of checking for file
formats. I would like to upload jpeg, gif and text files reliably.
Thank you
John
Comment