Archived from the Transloadit support forum. Originally posted on August 8, 2012; details may be outdated, see our docs for current behavior. Original thread
Quick question about changing the filename when uploading to S3…
I set a hidden variable in my form called “fileprefix” to some special prefix text as I do not want to use your 33 digit unique prefix when uploading to S3:
Which turns into something like the following:
In my template, in the store section, I also set the path variable option to:
“path”: “${fields.fileprefix}${file.url_name}”
I also tried this variation:
“path”: “${fields.fileprefix}”
But, it is not working, so i must be doing something wrong. The point is just to add a string prefix to the start of the filename and have them all in the same folder. Your 33 digit string goes 2 folder levels deep, but that is a pain, I just want a simple numbering strategy with all my uploads in the top level S3 bucket.
So, the question is what is the correct syntax for simply adding a string prefix to the title of the uploaded file when it gets saved to S3? I assume the path variable is the proper place in the template to store that data, but perhaps that is not really clear as I am not even sure if I am supposed to add the url_name on it or not. Can’t find the answer in your documentation.
Thanks, I just want to be able to organize my bucket the way I want to see it.
Ben Cahan