View Full Version : MP3 file is showing as application/x-unknown

03-02-2010, 04:48 PM
Hello everyone. First time poster here.

I have an upload script that checks the $_FILES['xxx']['type'] value against an array and echoes it back to me. Every time I try to upload an MP3 file I get application/x-unknown printed as the type. I know these are mp3 files. Does anyone know why it would be interpreted as unknown?
Thanks in advance :)

03-02-2010, 04:51 PM
Is the 'type' itself saying its x-unknown, or is that what you're script is saying as a result?
Also, special note should be taken that these are provided by the client, and not by PHP. The type specified in a file upload should be considered tainted.

03-02-2010, 05:00 PM
Yes the script is resulting in that type.

echo $_FILES['file']['type'];

That line in particular. Not sure why though. The file is definitely an MP3 file.
I always consider uploads tainted from the beginning which is why I check the mime type and not just the file extension.

03-02-2010, 05:07 PM
I figured this out. It is actually a Firefox issue and not the code. Thanks for your help :)

03-02-2010, 05:07 PM
printf("Error code: %d\n", $_FILES['file']['error']);

Post the error code for the upload. Also, I assumed you're form is posted with an encoding type of multipart/form-data?

Firefox is to blame? What was the problem?