使用 cordova 应用程序上传文件无法在远程服务器上运行

File upload using cordova app not working on remote server

我正在尝试使用我的 cordova 应用上传文件。当我使用 localhost url 进行测试时,文件已成功上传。现在,当我尝试使用远程服务器时,出现以下错误。看起来它甚至没有点击上传-url

FileTransferError {code: 1, source: "file:///storage/emulated/0/rec_13_13_11.wav", target: "https:///mobile_api/upload-hla-call-recording", http_status: 500, body: null, …}
body:null
code:1
exception:"https://route/to/upload/file"
http_status:500
source:"file:///storage/emulated/0/rec_13_13_11.wav"
target:"https://route/to/upload/file"

这是上传文件的代码

fileSystem.root.getDirectory(dirName, {

                create: false

            }, function (dataDir) {

                fileURI = dataDir.toURL();

                fileURI = fileURI + fileName;

                var options = new FileUploadOptions();

                options.fileKey = "fileKey";

                options.fileName = fileURI.substr(fileURI.lastIndexOf('/') + 1);

                options.mimeType = "audio/mp3";

                options.chunkedMode = false;

                var ft = new FileTransfer();

                ft.upload(fileURI, server-url, win, fail, options, true);

            }, dirFail);

我正在使用 cordova-plugin-file-transfer 上传文件

问题是关于 guzzlehttp。当我的本地主机在 http 上工作时,它正在寻找 https 连接。为 http 强制卷曲或为您的 http 请求提供证书。