Closed 0xmbadr closed 4 months ago
Hi, what storage are you using?
When loading fails or when validation fails or request success, the delete method is called when autoDeleteFile is enable (enabled by default) , which is declared as abstract in StoredFile
to delete a file from temporary storage.
Thus, the files will be deleted after a failed upload.
Also we have test for check auto delete logic.
If this is not happening in your case, could you please create a minimal repository with the problem reproduced so that I understand what exactly is going wrong.
Thank you for your quick reply.
In my case, I want to save files in a specific directory to be accessed later with their paths saved in my database. I am using FileSystemStoredFile
with autoDeleteFile: false
. Everything works fine, except for the cases when validation goes wrong, unneeded files are still saved.
Is there a way to improve my approach?
@0xmbadr Hi, please check out v1.9.7, there was autoDeleteFile
config field separated to two fields: cleanupAfterSuccessHandle
and cleanupAfterFailedHandle
.
You can use the next configuration for auto delete file when error caused and save when everything is okay:
{
cleanupAfterSuccessHandle: false,
cleanupAfterFailedHandle: true // default is true
}
Please reopen issue when your problem wasn't resolved.
It appears that files are still being uploaded even when the validation process fails. Is there a way to make sure files are deleted after a failed validation?
Thank you.