Simple question, how to create an angularjs upload form to Parse.com?
I am trying to create a profile picture uploader form using using this stackoverflow answer, but it not works
HTML code
<div class="col-lg-9" ng-controller="manageProfile">
<form style="margin-top:80px">
<div class="form-group">
<label>Browse for Picture</label>
<input type="file" name="profPic" id="profPic"></input>
</div>
<button class="btn btn-md" ng-click="uploadPicture()">Upload Picture</button>
</form>
</div>
AngularJS code
profile.controller('manageProfile', ['$scope', function($scope) {
$scope.uploadPicture = function() {
var fileUploadControl = $("#profPic")[0];
var file = fileUploadControl.file[0];
var name = file.name;
var parseFile = new Parse.File(name, file);
parseFile.save().then(function() {
var currentUser = Parse.User.current();
currentUser.set("profilePicture", parseFile);
currentUser.save();
}, function(error) {
alert("Error: " + error.code + ' ' + error.message);
});
}
I got this error when trying to upload
error: fileuploadcontrol is undefined