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
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    5
    Thanks
    3
    Thanked 0 Times in 0 Posts

    MP3 file is showing as application/x-unknown

    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

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    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.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • Users who have thanked Fou-Lu for this post:

    blatant3 (03-02-2010)

  • #3
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    5
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Yes the script is resulting in that type.
    Code:
    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.

  • #4
    New to the CF scene
    Join Date
    Mar 2010
    Posts
    5
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I figured this out. It is actually a Firefox issue and not the code. Thanks for your help

  • #5
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    PHP Code:
    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?

    Edit:
    Firefox is to blame? What was the problem?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Tags for this Thread

    Posting Permissions

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