I am trying to upload a file from my local file system (/local/dir/file.png) to my AmazonS3 Bucket (bucket/dir/file.png). I am using node-webkit and aws2js. My code looks something like..
s3 = require('aws2js').load('s3', "AWS_KEY", "AWS_SECRET").setBucket("bucket");
var key = '/dir/file.png'
var path = '/local/dir/file.png'
s3.putFile(key, path, "public-read", {}, function (err,data) {
if(err) console.log(err);
console.log(data);
});
The following error keeps getting passed throught to the callback and the file is not uploaded..
Error { code: "EACCES", errno: "EACCES", syscall: "spawn" }
I have done some reading.. and from what I can gather this is a permission issue. My question is what permissions do I need to change to resolve the error?
UPDATE :
I just tried uploading a string using the lower function call put and it uploaded the object.. which suggests to me it is not the S3.
s3.put(key, {}, "somestringcontent", function (err,data) {
if(err) console.error(err);
console.log(data);
})
Then I tried the following.. which also worked.
var file = fs.readFileSync(path);
s3.put(key, {}, file, function (err,data) {
if(err) console.error(err);
console.log(data);
})
But when I try the following.. it fails!
s3.put(key, {}, {file:path}, function (err,data) {
if(err) console.error(err);
console.log(data);
})
Hi you need to give permission to folders to be able to put files. Please try "chmod -R g+w /local/dir/" ?