Can't delete last file in a multi-value file upload record field

I am using a multi-value file upload field for file attachments to a record. After testing it by attaching a few files, I tried to delete them but am unable to delete the last one ( I still get a success message when attempting to delete it, but the file entry remains). Any thoughts?

Hmm, I can’t seem to replicate it, are there any special configurations on the module/table or anything else?

Please provide detailed steps, where and how are you trying to delete them?

Nothing special. It was a file upload field, with multi-value selected in the configuration. I had placed the field on a record page. I loaded three files into the field, then tried to remove them one at a time using the delete button. The last one would not delete, although I did get a “Success” message telling me that file had been deleted. Refreshing the record page did not solve the problem - the file still appeared in the field.

I have since deleted the field and shifted to a separate module for file attachments (allowing metadata about the file to be entered).

This leads to another question about how Corteza handles file uploads. If a file is uploaded, does it remain in the file system on the server even if its associated record is deleted, or does Corteza somehow know when a file should be deleted?

Are you able to replicate it?
Im confused since there is no notification for deleting a file.

I just tried the exact same thing and no notification is there, I was able to successfully delete the files though.

Regarding the second question
Attachments are saved to file storage, and not deleted. Just the pointer to them is.

So the files remain in file storage. Is there any systematic way to clean up files that are no longer in use?

Hi, best way would be using a cron script that would check which files were removed in db and then unlinking them from fs.

You would do something similar in a kubernetes environment via some node.js image that would do the same (connect to db, remove from volume).

We do not have a mechanism to cleanup yet though, but I agree, it is needed.

1 Like