Change and set a custom File Name -> FileStorageUpload?

Hi!
Is there a way to change the original filename of a file uploaded using FileStorageUpload?

Thanks!

I think this can be done if you use manual mode.
Illustration based on an example from the documentation: fileStoragePutMode

<fileStorageUpload id="manuallyControlledField"
                   property="image"
                   fileStoragePutMode="MANUAL"/>

In controller

@Autowired
    private TemporaryStorage temporaryStorage;
    @Autowired
    private FileStorageUploadField manuallyControlledField;

    @Subscribe("manuallyControlledField")
    public void onManuallyControlledFieldFileUploadSucceed(SingleFileUploadField.FileUploadSucceedEvent event) {
        FileRef fileRef = temporaryStorage.putFileIntoStorage(manuallyControlledField.getFileId(), "renamed_"+event.getFileName());
        manuallyControlledField.setValue(fileRef);
    }

image

Thanks!
How could I achieve this with Azure/AWS. permanent file storage?

This should work for any storage.
You define a new file name before uploading to permanent storage.

Yeah, looking at the example you sent me I thought that would be the way to do it.
Lastly, would you kindly send me an example of how to save from temp storage to azure permanent storage using your code above ?
Many thanks in advance

If AWS is the only store, it is the default store. You don’t need to make any changes to the sample code.:
AWS File Storage

If you use both AWS and local storage, you can specify the name of the storage for ‘FileStorageLocator’ via the ‘fileStorage’ attribute:

<fileStorageUpload id="manuallyControlledField" clearButtonCaption="clear" clearButtonDescription="clear description"
                                   clearButtonIcon="CLOSE" showClearButton="true" property="photo" showFileName="true"
                                   dataContainer="newEntityDc" fileStoragePutMode="MANUAL" fileStorage="awsfs"/>

Or programmatically control the storage selection. All this is described in the documentation: Using Multiple File Storages