I am currently utilizing the Javascript API for parse.com within an Angular JS application. My goal is to successfully save or update the user's profile picture. Below is the code snippet that I have been working with:
Some HTML . . .
<input type="file" capture="camera" accept="image/*" id="profilePhotoFileUpload">
Credit goes to Google I/O, Raymond, and the Parse JS guide.
Here is the controller code snippet:
$scope.updateUserProfile = function (user) {
var fileUploadControl = $("#profilePhotoFileUpload")[0];
if (fileUploadControl.files.length > 0) {
var file = fileUploadControl.files[0];
var name = "photo.jpg";
var parseFile = new Parse.File(name, file);
parseFile.save();
}
An error keeps popping up:
TypeError: Cannot call method 'then' of undefined at Object.Parse.File.save (parse-1.2.8.js:4084:43)
It occurs when trying to execute parseFile.save()
Essentially, the _source is appearing as undefined . . . Any ideas why?
Thank you!