Phonegap Filetransfer works on iOS nothing happens on Android -



Phonegap Filetransfer works on iOS nothing happens on Android -

now, have problem uploading images on server. code works on ios devices, when i'm trying upload on android, doesn't anything. before filetransfer, i'm trying alert imageuri, it's not happening well.

i'm using phonegap build phonegap version 3.4.0 , sencha touch 2.3. in config.xml utilize core phonegap photographic camera plugin: <gap:plugin name="org.apache.cordova.camera" />.

my fileupload script looks this:

ext.define('my_app.controller.fileupload', { extend: 'ext.app.controller', requires: [ 'ext.messagebox' ], config: { refs: { fileupload: '#fileupload', getlibraryimage: 'button[action=getlibraryimage]', getcameraimage: 'button[action=getcameraimage]' }, control: { getlibraryimage: { tap: 'getlibraryimage' }, getcameraimage: { tap: 'getcameraimage' } } }, getlibraryimage: function() { navigator.camera.getpicture(this.fileupload, onfail, { destinationtype: camera.destinationtype.file_uri, sourcetype: camera.picturesourcetype.photolibrary, allowedit: true, targetwidth: 800, targetheight: 800 }); function onfail(message) { alert('failed because: ' + message); } }, getcameraimage: function() { navigator.camera.getpicture(this.fileupload, onfail, { destinationtype: camera.destinationtype.file_uri, sourcetype: camera.picturesourcetype.camera, quality: 100, allowedit: true, targetwidth: 800, targetheight: 800 }); function onfail(message) { alert('failed because: ' + message); } }, fileupload: function(imageuri) { alert(imageuri); ext.viewport.setmasked({ xtype: 'loadmask', message: loc.t('loadmask.fileupload'), stylehtmlcontent: true, indicator: true }); var options = new fileuploadoptions(); options.filekey = "file"; options.filename = imageuri.substr(imageuri.lastindexof('/') + 1); options.mimetype = "image/jpeg"; // if (ext.os.is('android')) { // options.chunkedmode = true; // } var user = json.parse(localstorage.getitem('user')); var user_id = user.id; var username = user.username; var params = new object(); params.user_id = user_id; params.username = username; options.params = params; var ft = new filetransfer(); ft.upload(imageuri, encodeuri("my_upload_uri"), win, fail, options); function win(response) { if (ext.json.decode(response.response).error) { ext.viewport.setmasked(false); ext.msg.alert('my_app', ext.json.decode(response.response).error); } else { my_app.app.getcontroller('basic').profileimages(); ext.msg.alert('my_app', ext.json.decode(response.response).success); } } function fail(error) { ext.viewport.setmasked(false); alert("an error has occurred: code = " + error.code); } } });

if can see problem, i'd appreciate help! in advance.

my problem solved upgrading phonegap version 3.6.3.

android ios cordova file-transfer

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -