Php 移动音频上传返回八位字节/流

Php 移动音频上传返回八位字节/流,php,audio,upload,mime-types,Php,Audio,Upload,Mime Types,在桌面上,上传工作正常,但当我尝试从移动设备上传时,它说扩展在数组之外,print返回八位字节流,有什么想法吗?我看不出有什么不对。我尝试了许多音频扩展,检查了MIME,并用一些智能手机进行了测试,但都没有成功 if (isset($_POST['submit_atrack'])) { $fileinfo=PATHINFO($_FILES["audio"]["name"]); $newFilename=$fileinfo['filename'] . uniqid($usr_idLogged) .

在桌面上,上传工作正常,但当我尝试从移动设备上传时,它说扩展在数组之外,print返回八位字节流,有什么想法吗?我看不出有什么不对。我尝试了许多音频扩展,检查了MIME,并用一些智能手机进行了测试,但都没有成功

if (isset($_POST['submit_atrack'])) {
$fileinfo=PATHINFO($_FILES["audio"]["name"]);
$newFilename=$fileinfo['filename'] . uniqid($usr_idLogged) . "." . $fileinfo['extension'];
move_uploaded_file($_FILES["audio"]["tmp_name"],"atracks/" . $newFilename);
$location = 'atracks/' . $newFilename;

$formatos = array('audio/mpeg', 'audio/ogg', 'audio/mp3', 'audio/*', 'audio/wav');
$tamanho_max    = 500000000; //500 mb


    if (empty($_FILES['audio']['name']))
    {
        $upload_empty = urlencode("empty");
        header("Location:playlist?newtrack=".$upload_empty . "&playlist=" . $selectedPlaylist);
        exit;
    }
    else if (!in_array($_FILES['audio']['type'], $formatos))
    {
        $upload_incorrectformat = urlencode("incorrectext");
        header("Location:playlist?newtrack=".$upload_incorrectformat . "&playlist=" . $selectedPlaylist);
        exit;
    }
    else if (in_array($_FILES['audio']['type'], $formatos)) 
    {
        if($_FILES['audio']['size'] >= $tamanho_max)
        {
            $upload_maxsize = urlencode("maxsizereached");
            header("Location:playlist?newtrack=".$upload_maxsize . "&playlist=" . $selectedPlaylist);
            exit;
        }
        else 
        {
            $atitle = mysqli_real_escape_string($connection, $_POST['atitle']);
            $atag = mysqli_real_escape_string($connection, $_POST['atag']);
            $atagcolor = mysqli_real_escape_string($connection, $_POST['atagcolor']);
            mysqli_query($connection,"INSERT INTO tbl_users_atrack (atrack_title, atrack_path, atrack_tag, atrack_tagColor, atrack_playlistId) VALUES ('$atitle', '$location', '$atag', '$atagcolor', '$selectedPlaylist')");
            $upload_success = urlencode("success");
            header("Location:playlist?newtrack=" . $upload_success . "&playlist=" . $selectedPlaylist);
            exit;
        }
    }
}

试着准确地检查发布的内容。print_r($\u POST)和print_r($\u文件)可能会对您接收到的内容以及它超出预定义类型的原因有所帮助。除了返回
application/octet stream
的MIME类型外,所有内容都是正确的,但文件相同,使用相同的代码被标识为
audio/mp3
application/octet流只是许多环境对字节流的命名。所以这是相当普遍的。(有时不带扩展的附件是这样传递的)。$\u文件中没有任何其他提示吗?与原始文件名类似?您的代码易受SQL注入攻击。你应该使用事先准备好的陈述。