Default file storage structure contains 3 levels of nesting – year, month and day.
I want to override this structure to have two levels of nesting – year (defined as entity attribute) and serial number of directory (according to already created directories for the specific year directory).
Could you please provide an example?
1 Like
To change the structure you should override cuba_FileStorage bean on middleware. To do this you need to create a new implementation of the com.haulmont.cuba.core.app.FileStorageAPI interface and add it to spring.xml:
<bean name="cuba_FileStorage" class="com.company.NewFileStorageFullQualifiedName"/>
You can extend the existing FileStorage implementation and override getStorageDir() method. If there are not enough parameters to implement the method in a way you want, you will need to override all methods of the interface.