New to Meteor. I have already set up Cloudinary so that users can upload a profile photo. I am having difficulty retrieving that profile photo.
Template.userProfile.events({
'submit form': function(e, t) {
e.preventDefault();
var files = [];
var file = $('#userimage')[0].files[0];
files.push(file);
Meteor.call('uploadPhoto', Meteor.userId(), "test")
Cloudinary.upload(files, function(err, res) {
console.log("Upload Error: " + err);
console.log("Upload Result: " + res);
});
},
});
The idea is that I will somehow retrieve the photo_id from cloudinary (which I don’t know how to do) and then insert it where “test” is at now. The uploadPhoto method is just intended to add the photo_id to the user:
uploadPhoto: function(userId, photoId) {
Meteor.users.update(userId, {
$set: {photoId: photoId}
});
}
So when a user logs in, I can grab the get their photo_id and use it to display the photograph on their profile page and on the navbar.