...

View Full Version : MIME type of mp3 file



maghiel
02-28-2007, 04:04 PM
Well not truly a PHP issue, but it comes close :)

I'm uploading mp3 files and ofcourse checking the MIME type, and I would
expect that the MIME type would be audio/mpeg or audio/x-mpeg.
But, instead of that it recognizes the mp3 file as application/octet-stream.

How can that be? I deffinetly not want to allow that type as it would create a mayor security issue. checking for extension is also no option; that's easely bypassed.

Does it have something to do with de ID3v2 information in the beginning of the file? i know octet has got something to do with 7-bit stuff, and in ID3v2 tags are syncsave using 7-bit bytes.

Hope anyone could help!

thnx!

maghiel
02-28-2007, 04:13 PM
note: this behaviour is when reading $_FILES['type'];
when i output MIMEtype using:
echo(system("file -i -b foobar.mp3"));

it does output audio/mpeg

:|

maghiel
03-01-2007, 09:33 AM
anyone?

bcarl314
03-01-2007, 02:41 PM
Rather than useing the $_FILES['uploadFile']['type'] for checking, why not use your system command to check the file type of $_FILES['uploadFile']['tmp_name']???

maghiel
03-01-2007, 03:09 PM
Rather than useing the $_FILES['uploadFile']['type'] for checking, why not use your system command to check the file type of $_FILES['uploadFile']['tmp_name']???

guess that's an idea :) thnx m8 :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum