3

I'm working on uploading image as base64 image stream from phonegap/cordova application, it works perfectly fine in Android but not working in ios, however in ios it works when the image is as png/jpg but when it is as base64 image stream its not working, Please can anybody help me out with the same.

Here is my code for the same,

var options = new FileUploadOptions(); options.fileKey = "file"; options.fileName = "test.jpg"; options.mimeType = "image/jpeg"; options.chunkedMode = false; options.params = { "key": "test.jpg", "AWSAccessKeyId": awsKey, "acl": acl, "policy": policyBase64, "signature": signature, "Content-Type": "" }; var ft = new FileTransfer(); ft.upload(imageURI, s3URI + "", win, fail, options); } function win(r) { console.log("Code = " + r.responseCode); console.log("Response = " + r.response); console.log("Sent = " + r.bytesSent); alert(r.response); } function fail(error) { alert("An error has occurred: Code = " + error.code); } 
5
  • if you are using the base64, why don't you just use a simple AJAX POST? Commented Jan 12, 2015 at 7:48
  • What error do you get? Commented Jan 12, 2015 at 9:00
  • @jcesarmobile In my app its sometimes base64 while some times its jpg/png its conditions based, hence I opted for FileTransfer, it really works well at android side and ios side too for jpg/png Commented Jan 12, 2015 at 9:42
  • 2
    @Emre: I get the error, Error Code 1 which says file not found only for base64 ios, In Android it works perfectly fine for base64 and png/jpg and in ios also it works fine for jpg/png but for base64 it gives File Transfer failed with Error Code 1 which says file not found Commented Jan 12, 2015 at 9:44
  • @MayuriRuparel, How did you upload base64 image using cordova-plugin-file-transfer in Android? I'm trying to do this and it's not working :/ Commented May 6, 2016 at 14:26

3 Answers 3

1

Version 1.5.0 of the file transfer plugin has already added that functionality. The patch was applied 14 Dec 2015.

You can see the commit here.

Upgrading the plugin solved the problem in my case at least.

Sign up to request clarification or add additional context in comments.

Comments

0

Set chunkMode true when use base64 for upload using phonegap

Comments

0

I set chunkMode true but still file is not transferring on server .It seems that cordova file transfer plugin does not support base64 image for upload on iOS.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.