Renaming files
When exporting files from Transloadit to a third party service, you might also want to change the name of the file so it is easily found later.
For example, when exporting to one of our supported exporting services like S3, you can specify the
file name as part of the path
parameter.
{
"steps": {
":original": {
"robot": "/upload/handle"
},
"exported": {
"use": ":original",
"robot": "/s3/store",
"credentials": "S3_CREDENTIALS",
"path": "renameFiles/${file.id}-${file.original_name}"
}
}
}
When importing your files from a URL, Transloadit will automatically derive the name of the file
from the URL. Although, if you'd rather specify your own name for the file, that's also possible
with the force_name
parameter.
{
"steps": {
"imported": {
"robot": "/http/import",
"url": "http://demos.transloadit.com/inputs/empty-sound.mp3",
"force_name": "audio",
"result": true
}
}
}
The code above will rename the imported file to audio.mp3
.