angularjs - How to upload an image file from a file path in ionic/parse? -
i have file_uri(which path file), how use upload file in parse? parse data "db" has column named "image" , file type field. how handle this? have attempted create parse file setting , saving no dice. thanks.
$scope.fileurl // file_uri "file:///var/mobile/containers/data/application/" var parsefile = new parse.file("img.png", $scope.fileurl); var image = new parse.object("image"); image.set("image", parsefile); image.save();
parse stores image in base64-encoded string, suggest convert image base64-encoded string first , save on parse.
there urltobase64 function here: how convert image base64 string using javascript
convertimgtobase64url('http://bit.ly/18g0vnp', function(base64img){ var parsefile = new parse.file("img.png", {base64: base64img}); });
parse file documentation: https://parse.com/docs/js/guide#files-creating-a-parse-file
Comments
Post a Comment