Page 1 of 1

Upload image from a URL

Posted: Fri Jun 05, 2015 7:19 pm
by Leonardo Valentin Zeferino

Hi!

How can I upload an image from URL (https://d2r1vs3d9006ap.cloudfront.net...)

I understood in this topic bellow but I didn't understood how can I converter an URL image to file binary content.

https://getsatisfaction.com/apperyio/...

Thanks.

Thanks.


Upload image from a URL

Posted: Fri Jun 05, 2015 9:38 pm
by Evgene Karachevtsev

Hello Leonardo,

Please check this post:
https://getsatisfaction.com/apperyio/...


Upload image from a URL

Posted: Sat Jun 06, 2015 8:35 pm
by Leonardo Valentin Zeferino

Hi Evgene!

Thanks for helping me.

I'm trying to use this code bellow but I don't know how I can select an image from url (https://d2r1vs3d9006ap.cloudfront.net...) instead of need to select a file with "".

codevar file;
function fileSelectHandler(e) {
var files = e.target.files || e.dataTransfer.files;
file = files[0];
previewFile();
}

function previewFile() {
var previewContainer = $('table[dsid=preview]');
var fileName = $('[name=fileName]');
var fileContentType = $('[name=fileContentType]');
// make the preview container visible once a file was selected
previewContainer.toggle();
// set the file name
fileName.text(file.name);
fileContentType.text(file.type);
var reader = new FileReader();
reader.onloadend = function(e) {
var fileDataUrl = e.target.result;
console.log("fileDataUrl: "+fileDataUrl);
localStorage.setItem("fileDataUrl", fileDataUrl);
//Set current avatar to the image component
Apperyio("Profile_Pic").attr("src", fileDataUrl);
};
//reader.readAsText(file);
//reader.readAsBinaryString(file);
//reader.readAsArrayBuffer(file);
reader.readAsDataURL(file);
}/code

Could you help me?


Upload image from a URL

Posted: Tue Jun 09, 2015 10:01 am
by Serhii Kulibaba