I am trying to upload a file using my cordova app. The file was uploaded successfully when i was testing with localhost url. Now when i am trying with my remote server, it gives me the following error. It looks like its not even hitting the upload-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"
Here is the code for uploading 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);
I am using cordova-plugin-file-transfer to upload the file
HTTP Status Code
500
simply means there's something wrong in yourPHP
code. – Amit Merchant<domain>/route/to/upload/file
really exists on your Server? I mean in document root of your web app? Did you check write permissions of your webserver? – Nordseebaer