File upload in ionic (image or any file)? -


can 1 please sort out gives error filetransfer not defined.

below code

controller("examplecontroller", function($scope, $cordovafiletransfer) {       $scope.upload = function() {         var options = {             filekey: "avatar",             filename: "yedu.jpg",             chunkedmode: false,             mimetype: "image/jpg"         };         $cordovafiletransfer.upload("http://192.168.1.109/uploads/upload", "/android_asset/www/img/yedu.jpg", options).then(function(result) {             console.log("success: " + json.stringify(result.response));         }, function(err) {             console.log("error: " + json.stringify(err));         }, function (progress) {             // constant progress updates         });     }  }); 

i think getting error in browser . per official documentation of plugin plugin not supported browser more details go here , here.

if testing in browser before installing app in device add cordovafiletransfer plugin project.

      cordova plugin add org.apache.cordova.file-transfer 

and full implementation of file upload , download cordova may go here.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -