for example:
knox.js:
knox.putFile("local.jpeg", "upload.jpeg", {
"Content-Type": "image/jpeg"
}, function(err, result) {
if (err != null) {
return console.log(err);
} else {
return console.log("Uploaded to amazon S3");
I have two images in the same directory as knox.js, local.jpeg and local2.jpeg, i am able to upload local.jpeg to s3, but not local2.jpeg, both files have the same permissions. am i missing anything here? thanks
That’s because your code does not uploade local2.jpeg!
You code will only pushes the file named
local.jpeg. You should, for every file, invoke theknox.put()method. I also advise you to have some helper function that will do some string formatting to rename to uploaded file on s3 (or just keep it as it is 🙂 )