Jmix FileStorage + MinIO: Keep only the last uploaded file

Hi Jmix team,

I’m integrating MinIO storage into my Jmix application (v2.x), and I have a question regarding file uploads.

When a user uploads a file, then re-uploads (replaces) it multiple times before saving the entity, Jmix uploads every temporary file to MinIO, but only the last FileRef is actually stored in the entity.

How can I properly handle this use case so that:

  1. Only the final uploaded file is stored in MinIO
  2. And temporary or unused uploaded files are not stored or can be cleaned automatically?

Thanks!

Hi!

This is a normal situation when you use the fileStorageUploadField with the “IMMEDIATE” mode. And it is not specific for AWS(S3) file storage. The files in this case are always put into the main file storage(not the temporary). You can use the fileStorageUploadField with the “MANUAL” mode as it is described here Uploading Files :: Jmix Documentation. So you can use a temporary file storage and io.jmix.flowui.upload.TemporaryStorageManagementFacade#clearTempDirectory to clean it.