angularjs - Uploading image to Cloudinary (Mean) -
this question includes particulars framework, have general question on how upload photo file api. actual part of image submitting? content of photo?
i able upload image upon clicking button (using angular-file-uploader. however, don't know part of object should sending api.
the code below complain type error: can't convert circular structure json.
so can try grab file out of queue, when makes cloudinary, receive error: typeerror: file.match not function.
html
<div> <input type="file" nv-file-select uploader="user.uploader" /> <button ng-click="user.upload()">upload</button> </div>
controller
vm.upload = function() { console.log(vm.uploader); var photo = {file: vm.uploader.queue[0]} userdisplay.uploadphoto($stateparams.user_id, vm.uploader.queue[0]) }
api
cloudinary.uploader.upload(req.body.file, function(result) { console.log("made here"); console.log(result) });
cloudinary's angular library supports ng-file-upload, not angular-file-uploader.
there's code isn't displayed here. example userdisplay
?
you error because queue holds fileitem objects , not strings. should initialize fileuploader
upload url, , formdata
includes upload_preset
. way there no need override upload function.
you can see sample project on cloudinary's angularjs repo: https://github.com/cloudinary/cloudinary_angular/tree/master/samples/photo_album
Comments
Post a Comment