Skip to content

Error uploading a file #311

Description

@dortamiguel

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")
    }
})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions