Skip to content

Instantly share code, notes, and snippets.

@attashe
Created November 20, 2016 12:25
Show Gist options
  • Save attashe/858e587d52d0e5cadc0508e18e9580cb to your computer and use it in GitHub Desktop.
Save attashe/858e587d52d0e5cadc0508e18e9580cb to your computer and use it in GitHub Desktop.
function getImageUrl(name, message, imageBase64) {
let parseFile = new Parse.File(name, imageBase64);
let Telegram = Parse.Object.extend('Telegram');
let p = new Telegram();
p.set('message', message);
p.set('image', parseFile);
p.save().then(function() {
// The file has been saved to Parse.
let q = new Parse.Query('Telegram');
q.addDescending('createdAt');
q.limit(1);
q.find({
success: function (results) {
ev = results[0];
return ev.get('image').url()
},
error: function (error) {
alert("Events load error");
}
})
}, function(error) {
// The file either could not be read, or could not be saved to Parse.
alert("was error")
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment