Custom path for s3 uplaod

Is there any option for specifying custom path for the s3 upload. Everytime it is saving as Year>Month>date>UUID.csv. I need to save to a different path

You can override the AwsFileStorage bean and define your own structure in createFileKey() method.

Hi @krivopustov Thanks for the reply
I have created and override the AwsFileStorage

public class CustomAwsFileStorage extends AwsFileStorage {
protected String createFileKey(String fileName) {
System.out.println(“Custom class triggered”);
return fileName;

but when i try like this it is throwing cast exception.
CustomAwsFileStorage fileStorage = (CustomAwsFileStorage) fileStorageLocator.getDefault();
fileStorage.saveStream(path, inputStream);

Do you have any thoughts on this. Thanks

Did you define a bean for your new class?
Like this:

CustomAwsFileStorage customAwsFileStorage() {
    return new MyLocalFileStorage("custom_s3");

You should also have to set this property:

jmix.core.default-file-storage = custom_s3

Hi @krivopustov
Thanks it worked