upload files
Moderator: General Moderators
upload files
What is the best way to define a set of file types for uploads?
Comparing file extension to type makes little sense because of:
PHP manual wrote: $_FILES['userfile']['type']
The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however not checked on the PHP side and therefore don't take its value for granted.
- Ambush Commander
- DevNet Master
- Posts: 3698
- Joined: Mon Oct 25, 2004 9:29 pm
- Location: New Jersey, US
The config array will define what the allowed types are. In order to get the type from the file, however, you will have to sniff it using mime magic (if you have fileinfo, use finfo_file(), you can also try mime_content_type())