MIME types
Hi!
I am trying to validate that a file submitted through a form is a TEXT file.
When I use $_FILES['userfile_PFAM']['type']=='text/plain' it works, but only for files with .txt extension.
But the user may also have a file containing text data and may not have given the .txt extension (for example I found that application/octet-stream also reffers to TEXT files).
Does anybody know which of the MIME types of PHP must I check for? The MIME types that reffer to TEXT I mean.
Thanx!
lamad posted this at 16:17 — 2nd December 2005.
They have: 14 posts
Joined: Dec 2005
php does not have proper mime checking at this point, it's getting there, but will still default far to often to application/octet-stream to make it usefull. the best i've seen thus far is how gallery does it.
if you don't care about your php app running on windows, use the linux cli app "file".
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.