Page 1 of 1

Photoshop MIME type not working???

Posted: Tue Jun 05, 2007 8:06 am
by seodevhead
Hey guys... I have a contact form that allows users to upload files to me, and of those allowed file types, I want them to be able to send me .psd (photoshop) files. I have scoured the internet finding every possible mime-type for photoshop files, however, it is still not allowing upload of .psd files. (everything else works perfectly).

Below is a piece of my offending code:

Code: Select all

$allowed = array ('image/gif', 'image/jpeg', 'image/jpg', 'image/png', 'image/pjpeg', 'text/plain', 'application/postscript', 'image/bmp', 'image/x-windows-bmp', 'application/msword', 'application/pdf', 'image/tiff', 'application/excel', 'application/x-excel', 'application/x-msexcel', 'application/x-compressed', 'application/x-zip-compressed', 'application/zip', 'multipart/x-zip', 'video/quicktime', 'video/x-ms-wmv', 'image/x-photoshop', 'text/rtf', 'image/photoshop', 'image/x-photoshop', 'image/psd', 'application/photoshop', 'application/psd', 'zz-application/zz-winassoc-psd');
					if (!in_array($_FILES[$filename]['type'], $allowed))
					{
						$upload_valid = FALSE;
						$errors[] = 'This file type is not allowed for upload through this form.';
						unlink ($_FILES[$filename]['tmp_name']);
						
					}
Thanks for any help.

Posted: Tue Jun 05, 2007 8:11 am
by feyd
Likely, it's coming in under octet-stream.

Posted: Tue Jun 05, 2007 8:16 am
by seodevhead
Hey feyd,

You are right, it is coming in under 'application/octet-stream'.

However, my conditional is still failing. (producing the error).

I have updated my list to add-in 'application/octet-stream' but still no luck. Any idea what could be causing this? There are no other extraneous problems to speak of such as filesize, mem limits, etc.

Posted: Tue Jun 05, 2007 8:26 am
by feyd
Honestly, you should not even be using the supplied type information as it is entirely controlled by the submitting agent.

Use something like mime_content_type() or the other similar functions available to analyze the file itself.