I am trying to upload a user profile picture to parse.com with JavaScript SDK and I am stuck in referencing a media file. All the tutorials and documentation I could found point to 'uploading a local file' but I am trying to upload a file from url.
$('#parse').on('click', function () {
Parse.initialize(xxx, yyy);
var user = new Parse.User();
user.set("username", photos.owner_name);
user.set("password", "12349876");
user.set("email", photos.owner_id + "@blabla.com");
// other fields can be set just like with Parse.Object
user.set("phone", "000-000-0000");
user.set("nameLowerCase", photos.owner_name.toLowerCase());
user.set("name", photos.owner_name);
var url = '/images/tpp.png';
user.set("profileThumbnail", url);
user.signUp(null, {
success: function (user) {
console.log(user);
},
error: function (user, error) {
alert("Error: " + error.code + " " + error.message);
}
});
});
The documentation shows you how to upload a file to Parse cloud and using it's url; because I have the file uploaded already, I don't need to upload to Parse cloud.
I know, "url" variable is a string and I am lost. I appreciate any help in advance.