Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Jun 2004
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts

    MIME type of mp3 file

    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!

  • #2
    Regular Coder
    Join Date
    Jun 2004
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

    :|

  • #3
    Regular Coder
    Join Date
    Jun 2004
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts
    anyone?

  • #4
    Mega-ultimate member
    Join Date
    Jun 2002
    Location
    Winona, MN - The land of 10,000 lakes
    Posts
    1,855
    Thanks
    1
    Thanked 45 Times in 42 Posts
    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']???

  • #5
    Regular Coder
    Join Date
    Jun 2004
    Posts
    130
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by bcarl314 View Post
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •