Automattic / knox

S3 Lib
MIT License
1.74k stars 285 forks source link

Error uploading a file #311

Open dortamiguel opened 8 years ago

dortamiguel commented 8 years ago

I'm using this code for uploading an image, I follow the docs but I'm getting an 301 error from amazon. Is this a bug in knox? The amazon cli uploads my files just fine.

require('dotenv').config()
var knox = require('knox')

var client = knox.createClient({
    key: process.env.S3_KEY,
    secret: process.env.S3_SECRET,
    bucket: process.env.S3_BUCKET
});

var file = "image.jpg"
var upload_name = "upload_" + file

client.putFile(file, upload_name, {"Content-Type": "image/jpeg"}, function (err, result) {
    if (err != null) {
        return console.log(err)
    } else {
        console.log(result.statusCode)
        return console.log("Uploaded to amazon S3")
    }
})
clementohNZ commented 7 years ago

I also have the same issue.

sundarapandian18 commented 7 years ago

I too have the same issue.