I’m writing a multiple file upload feature for myself.
The problem is that I’ll be uploading .psd, .cdr, .indd, .cad, etc. files.
I can easily check whether file is a legit image or not, but is there a similar way of validating the file extensions mentioned above.
EDIT the question is not about checking if file has an extension like psd, cdr etc. I need to be able to verify if the file is a legit PSD or CDR file.
Use the
FileInfofunctionality to get the real mimetype of the received files:http://www.php.net/manual/en/intro.fileinfo.php
Don’t trust the extension of the upload files, this is browser-sent data that’s easy to forge. Just assume the input file has no name, no extension.