I want to set or rename the filename of a file before it is uploaded. Is this possible with Filestack?

This is possible using the v3 library and the onFileSelected callback. Below please find some example code illustrating how this can be done. This will work for local files

Change Filename before Upload

Change Filename before Upload
var input = document.getElementById("store-input"); console.log(input.value); client.pick({ accept: 'image/*', storeTo: { location: 's3', }, onFileSelected: function(file) { file.name = input.value; return file; } }).then(function(result) { console.log(JSON.stringify(result.filesUploaded)) })

The above will work for changing the filename for local files, but won't work for files selected from cloud sources like google drive. If you need to change the filename on files selected from cloud sources you could also set the store path to the desired filename before the picker is instantiated.


Set custom path before Upload

Set custom path before Upload
var input = document.getElementById("store-input2"); console.log(input.value); client.pick({ accept: 'image/*', storeTo: { location: 's3', path: 'test/'+input.value }, onFileSelected: function(file) { file.name = input.value; return file; } }).then(function(result) { console.log(JSON.stringify(result.filesUploaded)) })