Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to upload file with custom name to s3(using s3store)? #333

Closed
ayush92garg opened this issue Dec 19, 2019 · 4 comments
Closed

How to upload file with custom name to s3(using s3store)? #333

ayush92garg opened this issue Dec 19, 2019 · 4 comments
Labels

Comments

@ayush92garg
Copy link

ayush92garg commented Dec 19, 2019

Question
Hi, my sincere apologies if this is a stupid question but I'm unable to find a way to upload files to s3 with a custom name and headers. I am using s3 store to directly upload files to my bucket.

I am able to read the original filename once the file is uploaded(below is the code), but how do I use this name while uploading? Do I need to rename the file once it is uploaded or is there a way to pass it before the upload starts? Any help would be really appreciated.

go func() { for { event := <-handler.CompleteUploads filename, filetype := event.Upload.MetaData["filename"], event.Upload.MetaData["filetype"] fmt.Println("Uploaded. File Details -->> ", filename, filetype) } }()

Setup details

  • Operating System: macOS
  • Used tusd data storage: AWS S3
  • Used tusd configuration: programmatic implementation
  • Used tus client library: tus-js-client
@Acconut
Copy link
Member

Acconut commented Dec 19, 2019

tusd does not have a native feature for this but you can rename the upload after it is completed. I added a FAQ entry for this: https://github.com/tus/tusd/blob/master/docs/faq.md#how-can-i-keep-the-original-filename-for-the-uploads

@segevfiner
Copy link

S3 doesn't support rename directly, meaning you will need to do a copy and delete, which can be extremely slow, sometimes taking as much time as the upload itself.

@Acconut
Copy link
Member

Acconut commented Feb 15, 2020

I know this may not be a satisfying answer for you, but if renames are to slow, you might have design your system without using the original file names. We are open to discuss alternative solutions but tusd currently does not offer such a feature.

Closing this issue since the original question was answered.

@Acconut Acconut closed this as completed Feb 15, 2020
@segevfiner
Copy link

Sadly that probably won't do for the kind of system we have in place that will use tusd. So we will have to either cope with the slow renames, or I'll might just try and see what it will take to add support to use the passed name instead of random IDs to tusd.

Akkarine added a commit to Akkarine/tusd that referenced this issue Mar 19, 2022
possibly fix for tus#488
- bumped alpine runtime in dockerfile
- get rid of [unmaintained](bmizerany/pat#17) routing library bmizerany/pat
- fixed CORS request test (status must be just 404, not 405, consequences of bmizerany/pat)
Akkarine added a commit to Akkarine/tusd that referenced this issue Mar 21, 2022
chore/fix tus#333:
- s3store - lowercase metadata keys, so client can send them in any case
- fix possible errors for empty Basepath ("/")
sec/fix tus#450 - allow accepting credentials (for example, Cookie, so forwarding in hooks will work as described in docs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants