bradleyg / django-s3direct

Directly upload files to S3 compatible services with Django.
MIT License
661 stars 234 forks source link

Adds in option to give all uploads unique filenames (prevents overwriting) #146

Closed noah-empire closed 5 years ago

noah-empire commented 6 years ago

It took me a while to get this PR up, so my apologies for the base branch being out of date.

I needed to be able to accept user uploads, but due to the nature of the upload there was a fair chance that multiple files would have the same filename and risk rewriting others. I built out this branch to append the last few digits of a timestamp to the filename when it is uploaded. It also strips the timestamp out when the filename is displayed to the user. This should stop (virtually) all collisions between user filenames.

Let me know if you think it would be a good addition!

bradleyg commented 5 years ago

You should be able to do this by passing and function to "key" in your S3 direct destination. LMK if your use case is different.