cordova - PhoneGap FileTransfer ProgressEvent Not Returning Values -
i'm building file transfer procedure hybrid/cordova app i'm creating. upload procedure works - when i'm getting stuck on creating process give feedback user on upload status (i'd give them x% uploaded...) type of notification box.
here's function i'm using:
function oncapturephoto(fileuri) { var win = function (r) { //misc procedures once upload completes retries = 0; getmyfeed(); clearcache(); } var fail = function (error) { //misc procedures if upload fails clearcache(); alert('ups. wrong happens!'); } //set upload options var options = new fileuploadoptions(); options.filekey = "file"; options.filename = fileuri.substr(fileuri.lastindexof('/') + 1); options.mimetype = "image/jpeg"; options.chunkedmode = true; options.headers = {connection: "close"}; options.params = { myuid:uid, myparty:party, mypin:pin }; var ft = new filetransfer(); //bring framework7 notification window myapp.addnotification({ message: '0% loaded...' }); //track upload progress ft.onprogress = function(progressevent) { if (progressevent.lengthcomputable) { loadingstatus.setpercentage(progressevent.loaded / progressevent.total); console.log(math.floor(progressevent.loaded / progressevent.total)*100) } else { loadingstatus.increment(); } }; ft.upload(fileuri, encodeuri("http://"+domain+"/smashit2.php?funct=savephoto2&uid="+theuid), win, fail, options); }
what missing? i've removed other jquery .html() stuff in favor of outputting stuff console simplicity. nothing being output console though.
Comments
Post a Comment