android - Uncaught ReferenceError: FileTransfer is not defined (using cordova 2.7.0) -
i want use filetransfer download file web server, code following:
function downloadfile(url) { var filetransfer = new filetransfer(); var uri = encodeuri(url); var filepath="www/download/"; filetransfer.onprogress = function(progressevent) { if (progressevent.lengthcomputable) { loadingstatus.setpercentage(progressevent.loaded / progressevent.total); } else { loadingstatus.increment(); } }; filetransfer.download( uri, filepath, function(entry) { console.log("download complete: " + entry.fullpath); }, function(error) { console.log("download error source " + error.source); console.log("download error target " + error.target); console.log("upload error code" + error.code); }, false, { headers: { } } ); }
when run app in simulator or real devide, hit error message: uncaught referenceerror: filetransfer not defined.
i have included cordova.js, reason error? thanks.
rgds brent
this plugin doesn't work browser, throw “new filetransfer not defined” error. use real device test.
Comments
Post a Comment