Closed Justicea83 closed 5 years ago
the responseCode is -1 and the error response is null
{ name: "fileToUpload", filename: file, mimeType: "image/jpeg" } Check the filename. file should be file path check. Console log path Response code -1 file not found or network error or server error. First try to upload any image file.
Is the mimeType required /storage/emulated/0/Download/adult-adventure-back-view-2819546.jpg is the file path { name: "fileToUpload", filename: file, mimeType: "image/jpeg" } and is it required for the object to have this exact names?
what will be the mimeType fo pdfs and MS word documents?
I also dont really get the content-type property
:wave: @Justicea83, we use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. Please, use Stackoverflow to get help.
Heres my code
let session = backgroundHttp.session(this.walletService.uuidv4()); let request = { url:
${this.authService.baseUrl}/log-fund
, method: "POST", headers: { "Content-Type": "application/octet-stream", "Authorization":Bearer ${this.user.token}
}, description: "Uploading " + this.uploadName }; const params = [ { name: "amount", value: this.amount.toString() }, { name: "payable", value: this.amount.toString() }, { name: "account", value: 'normal' }, { name: "reference", value: this.walletService.uuidv4() }, { name: "type", value: 'bank' }, { name: "bank_id", value: this.selectedBank.id.toString() }, { name: "pop", filename: this.imageUpload.toString() } ]; const task = session.multipartUpload(params,request); task.on("progress", (args) => { // console.log(args) }); task.on("error", (error) => { console.log('error'); console.log(error.response); console.log(error.responseCode) }); task.on("complete", (resp) => { //console.log(resp) console.log('complete') });