Aws s3 custom upload path

How can I upload to a custom s3 folder e.g “test” with uppy companion?

My code below:

new Uppy({ id: “uploader”, autoProceed: true })
.use(GoogleDrive, {
companionUrl: “url”
.use(AwsS3, {
companionUrl: “url”
.on(“upload-success”, (file, resp) => {
//do something


I do that server side - you can see my instructions for s3 + nodeJS here.

The salient line in the server code section is (note the “Account_Uploads/” - that’s the folder name - if the folder doesn’t exist in your s3 bucket, it will be created - I’m prepending a date stamp to the filename):

Key:`Account_Uploads/${}-${JSON.parse(Object.keys(req.body)[0]).filename}`, // what we'll call our file - here I'm using a folder called "Account_Uploads" to put all my uploads into, then prepending a date string to the filename to avoid collisions - S3 will overwrite a file if another with the same key (i.e. name) is uploaded! We have to again extract the filename in a tedious fashion...

Hope that’s helpful.

PS: I should add that I don’t use Companion, so YMMV…

thank you but i already had working with my own endpoint (php) the issue is how to pass data to companion

1 Like

Sorry - just now saw your response…

What does your server side code look like? Because the S3 options section of the Companion documentation indicates you simply prepend the filename with the folder name (the same way I do in the example I gave) - they suggest you can use data from the “req” object, but you can use anything - “test/” in your case:

"The req parameter can be used to upload to a user-specific folder in your bucket, for example:

  s3: {
    getKey: (req, filename, metadata) => `${}/${filename}`,
    /* auth options */

The default implementation returns the filename, so all files will be uploaded to the root of the bucket as their original file name.

  getKey: (req, filename, metadata) => filename



      getKey: (req, filename, metadata) => "test/" + filename

should work - I don’t think you have to worry about manually passing it to Companion. Does it work?