nativescript后台http上载文件到php

nativescript后台http上载文件到php,php,typescript,nativescript,Php,Typescript,Nativescript,我想使用nativescript后台http插件在我的服务器上上传音频文件。移动端工作正常。没有运行时错误。日志显示已完成上载,但当我访问服务器上的目录时,没有上载任何文件 这是我在nativescript上的代码 var session = bghttp.session("image-upload"); var audioFolder = fs.knownFolders.documents().getFolder("audio"); var recordedFile = audioFolder

我想使用nativescript后台http插件在我的服务器上上传音频文件。移动端工作正常。没有运行时错误。日志显示已完成上载,但当我访问服务器上的目录时,没有上载任何文件

这是我在nativescript上的代码

var session = bghttp.session("image-upload");
var audioFolder = fs.knownFolders.documents().getFolder("audio");
var recordedFile = audioFolder.getFile("recording.mp3");
var request = {
    url: "http://talktext.me/talktext.me(app)/recAudio.php",
    method: "POST",
    headers: {
        "Content-Type": "application/octet-stream",
        "File-Name": "recording.mp3"
    },
    description: "{ 'uploading': '" + "recording.mp3" + "' }"
};
alert(recordedFile.path);
let params = [
            { name: "test", value: recordedFile.path },
            { name: "fileToUpload", filename: recordedFile.path, mimeType: 'audio/mpeg' }
];
var task = session.multipartUpload(params, request);

task.on("progress", logEvent);
task.on("error", logEvent);
task.on("complete", logEvent);
function logEvent(e) {
   console.log("UPLOAD STATUS: "+e.eventName);

}
这是我在recAudio.php上的代码

$all_headers = apache_request_headers();
$newimg = file_put_contents('uploads/' . $all_headers['File-Name'], 
file_get_contents('php://input'));

手机上的一切都很好。但服务器上没有上载任何文件

我不是PHP专家,但我很久以前就开始研究它了。看起来像
php://input
不适用于多部分上载


来源:

确保服务器的.htaccess文件中的头对应用程序可用

RewriteCond %{HTTP:File-Name} .
RewriteRule .* - [E=HTTP_FILENAME:%{HTTP:File-Name}]

file_put_contents('uploads/' . $_SERVER['HTTP_FILENAME'],file_get_contents('php://input'));

$\u服务器['HTTP\u FILENAME']
没有值。