image - how to pass encoded base64 data to HTTP worklight adapter -


i have used cordova(navigator.camera.getpicture) capture image device. converted fileuri base64 using file reader. but, when assign base64 url img src whereas if pass same string http adapter(worklight), saw encoded data truncated. please help.

thanks in advance.

source code:

    function trytosend(evt) {         encoding = evt.target.result;         console.log("encoded file: "+encoding);         ext.componentquery.query('#encodedimage')[0].sethtml('<img style="height: 100px; width: 100px;" src="'+encoding+'" />');         ext.componentquery.query('#encodedimage')[0].sethidden(false);     }     function win(file) {         alert("filename:"+file.name + ' & type:' + file.type);         selectedfilename = file.name;         ext.componentquery.query('#originalimage')[0].sethtml('<img style="height: 100px; width: 100px;" src="'+file.fullpath+'" />');         ext.componentquery.query('#originalimage')[0].sethidden(false);         var reader = new filereader();         reader.onloadend = trytosend;         var encoded = reader.readasdataurl(file);      }     function fail(error) {         console.log(error);     }     function onresolvesuccesscompleted(fileentry) {         fileentry.file(win, fail);     }      function onresolvefailed(error) {         console.log(error);     } //call on click of take pic button function cappic(){  navigator.camera.getpicture(oncapturephoto, onfail, {         quality: 50,         destinationtype: destinationtype.file_uri,         sourcetype: camera.picturesourcetype.camera,         mediatype: navigator.camera.mediatype.allmedia,     }); } //success function oncapturephoto(fileuri) {     window.resolvelocalfilesystemuri(fileuri, onresolvesuccesscompleted, onresolvefailed);     filedetails.push({         base64imagedata:encoding,         filename: selectedfilename,     });    alert("file selected. please upload now"); }  //sending filedetails array http adapter parameter var invocationdata = {             adapter : 'sample_adapter',             procedure : 'uploadfilenow',             parameters : [filedetails]     };       wl.client.invokeprocedure(invocationdata, {         onsuccess : fileuploadok,         onfailure : fileuploadfail,     }); 

1) in logcat, encoding in trytosend fn prints whereas next line console.log gives truncated code

//ajax call ext.ajax.request({ url: url, method:'post', params:filedetails, success: function(response){ console.log(response); }, failure:function(response){ console.log(response); } });

in logcat console.log can print 4k characters 1 time. try compare encoded url's length check if it's truncated.


Comments