javascript - image.onError on jquery-mobile while uploading images -


i using phonegap run jquery mobile hybrid app.

i following tutorial in order upload image device (samsung note4, android 6.0.1) canvas, have tried different types of images getting execution result of image.onerror.

what reason of getting image.onerror execution?

here code tutorial:

function processfile(dataurl, filetype) {     var maxwidth = 800;     var maxheight = 800;      var image = new image();     image.src = dataurl;      image.onload = function () {         var width = image.width;         var height = image.height;         var shouldresize = (width > maxwidth) || (height > maxheight);          if (!shouldresize) {             sendfile(dataurl);             return;         }          var newwidth;         var newheight;          if (width > height) {             newheight = height * (maxwidth / width);             newwidth = maxwidth;         } else {             newwidth = width * (maxheight / height);             newheight = maxheight;         }          var canvas = document.createelement('canvas');          canvas.width = newwidth;         canvas.height = newheight;          var context = canvas.getcontext('2d');          context.drawimage(this, 0, 0, newwidth, newheight);          dataurl = canvas.todataurl(filetype);          sendfile(dataurl);     };      image.onerror = function () {         alert('there error processing file!');     }; } 


Comments