Page 1 of 1

mp3 MIMEType from FireFox 3 is application/download

Posted: Sun Dec 21, 2008 8:20 am
by skacc
Hello,
I am creating a function to validate filetypes when they are uploaded from a form, and i can not get around the folowing problem:
when i POST an .mp3 file using FF3.0.5 on Windows, then:
mime_content_type($_FILES['file']['tmp_name']) func returns: "audio/mpeg". That's ok.
But the $_FILES['file']['type'] contains "application/download".
IE works fine.

Is there anything i can do about that? Or what do you think if i let $_FILES['file']['type'] to be "application/download" when the file extension is mp3?

Oh, PHP Version 5.2.6

(Btw, i know instead of mime_content_type() i should use finfo_...(), but i can not get that func work on my local PC.)

Re: mp3 MIMEType from FireFox 3 is application/download

Posted: Sat Dec 27, 2008 3:26 pm
by cptnwinky
Well a hackish way to work around it would be too....

Code: Select all

 
if(preg_match("/^.*\.(mp3)$/i", $filename)) {
    // Overide the default value
    $_FILES['file']['type'] = "audio/mpeg";
}
 

Re: mp3 MIMEType from FireFox 3 is application/download

Posted: Sat Dec 27, 2008 5:17 pm
by skacc
Ye, i think thats the best i can do.
Thank you for the idea