why some mp3s on mime_content_type return application/octet-stream

Posted by robertdd on Stack Overflow See other posts from Stack Overflow or by robertdd
Published on 2010-05-02T19:48:42Z Indexed on 2010/05/02 19:58 UTC
Read the original article Hit count: 100

Filed under:
|
|

why on some mp3s file when i call mime_content_type($mp3_file_path) it's return application/octet-stream?

i have this:

if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $image = getimagesize($tempFile);
    $mp3_mimes = array('audio/mpeg', 'audio/x-mpeg', 'audio/mp3', 'audio/x-mp3', 'audio/mpeg3', 'audio/x-mpeg3', 'audio/mpg', 'audio/x-mpg', 'audio/x-mpegaudio'); 

    if (in_array(mime_content_type($tempFile), $mp3_mimes)) { 
        echo json_encode("mp3");
    } elseif ($image['mime']=='image/jpeg') {
        echo json_encode("jpg");
    } else{
        echo json_encode("error");
    }
}

© Stack Overflow or respective owner

Related posts about mime-content-type

Related posts about php