cinely / mule-uploader

Stubborn HTML5 Amazon S3 uploader
http://mule-uploader.com/
MIT License
223 stars 43 forks source link

Original file names on S3 #21

Closed roundrobin closed 10 years ago

roundrobin commented 10 years ago

thanks for the good library, its a great start for one of my projects. I was wondering why uploaded files on S3 have a random name (some number) instead of the original file name.

Is there a way to change that?

roundrobin commented 10 years ago

I think I found it, this is where you set it right now, correct? https://github.com/cinely/mule-uploader/blob/master/mule-uploader.js#L196

I have to actually think about it, if it makes sense to use the original file name. Did you ever had filename collisions with your random file name approach? Wouldn't it be better to generate a random name based on a unix timestamp+a random nr?

gabipurcaru commented 10 years ago

Sorry for the (SO!) late reply. The thing is, I found it easier to use random keys because I don't have to worry about things like proper escaping, and I do set the Content-Disposition header, so when someone downloads the file, it gets downloaded under the original filename. It's just the URL that looks different.

The keys are assigned in the backend, e.g. https://github.com/cinely/mule-uploader/blob/master/example_backend.py#L100

You can just change that line to whatever you want -- including filename.

scrolls-mckenzie commented 8 years ago

Can you please elaborate a bit more here.