Set Filename

Archived from the Transloadit support forum. Originally posted on July 18, 2011; details may be outdated, see our docs for current behavior. Original thread

Hi,

Is there a way to choose the filename of the upload. I am uploading from javascript and storing on S3.

Yes, if you could pass the desired filename from the jQuery plugin that would be great. As far as I can tell, there’s no option for that.

We currently don’t support custom file names, but I’d like to know more about this request. Why would you want to change the file name? Are you concerned about the name on S3? How would you imagine this to work with a multiple file upload?

Hi Felix,

Thanks for your interest.

The main reason we’re looking to change our image filenames is for SEO purposes. Currently our image URLs are:

http://000.s3.amazonaws.com/22/3jh289d7s0932kjhldf98x7v76cx75/250x250.png

ie) If the title for the post is “Top 100 CPU Charts”, using jQuery we would automatically generate a filename “top-100-cpu-charts.png” and overwrite the filename “250x250.png” that the user uploaded.

Great service BTW, <3 Transloadit, makes my work life so much easier.

Do you already know the name you want to use for the file before the user selects it? If so, you could dynamically merge in a path parameter when rendering the form:

http://transloadit.com/docs/templates#passing-variables-into-a-template

Just what I was looking for! Thanks for pointing me in the right direction.

:smiley: