founderlab / react-dropzone-s3-uploader

Drag and drop s3 file uploader via react-dropzone + react-s3-uploader
MIT License
161 stars 82 forks source link

How to specify path of upload #51

Open tmf-chris opened 6 years ago

tmf-chris commented 6 years ago

I am trying to get the file uploaded into a path such as this:

/folder1/folder2/filename.jpg

I am passing in an s3Url such as this:

const s3Url = 'https://s3.us-west-1.amazonaws.com/mybucket/'; const path = 'folder1/folder2'; ... <DropzoneS3Uploader onFinish={this.handleFinishedUpload} s3Url={s3Url} maxSize={1024 * 1024 * 5} upload={{s3path: path}} />

What this is doing is adding the file but it is adding the unique id stuff (that s3 prepends to the url) to the first folder:

/iweufhwe_folder1/folder2/filename.jpg

Whereas I would like it to be:

/folder1/folder2/iweufhwe_filename.jpg

tmf-chris commented 6 years ago

Looks like the version of react-s3-uploader being used for this project is a bit old. A recent fix:

https://github.com/odysseyscience/react-s3-uploader/commit/542f1522c1919091e90d36ce29f8ef51face3e73

Seems to suggest they fixed an issue when you supply your own path. Could we get an update that brings in the latest version of react-s3-uploader?

fernandobandeira commented 6 years ago

I've had this issue, upgrading the react-s3-uploader to use version 4.8.0 fixed it for me.

For those of you that need a fix urgently, you can use the repo which I;ve upgraded the version, add this to your package.json:

"react-dropzone-s3-uploader": "git+https://git@github.com:fernandobandeira/react-dropzone-s3-uploader.git",

Also, consider forking the repo to yourselves and change it back to this repo once the maintainer fixes the issue.

aysark commented 6 years ago

Yeah this package seems to be no longer maintained...