Closed nilsi closed 8 years ago
Hmm, the package doesn't support that use case, you'll have to use something like Knox for sure :D. It shouldn't be too difficult though, it seems a lot of other packages support it.
Thanks, this is probably not the best solution but I managed to do it like this using Knox:
var http = Npm.require("http");
var filename = makeFilename();
var req = http.get("http://www.planwallpaper.com/static/images/Winter-Tiger-Wild-Cat-Images.jpg", function(resp) {
var buffer = new Buffer("", "binary");
resp.on('data', function(chunk) {
buffer = Buffer.concat([buffer, chunk]);
});
resp.on('end', function() {
var headers = {
'Content-Type': resp.headers["content-type"],
'Content-Length': buffer.length,
'x-amz-acl': 'public-read'
};
var req = S3.knox.putBuffer(buffer, filename, headers, function(err, res){}); //upload image, assume its ok
});
});
Is there a way to upload an image by URL instead of using file input?
Im getting our users profile image URL from Facebook and Twitter and want to upload it to our server.
Can I do this or I have to use Knox or something similar?
Example of image I want to upload to server: https://scontent.xx.fbcdn.net/v/t1.0-1/p200x200/546300_10150715883269244_491882184_n.jpg?oh=083213e80a24e47424c739402e1e154f&oe=5836C4EC
I was thinking if I could create a File object from the URL but having problem finding any information regarding this.
Thank you.