Delete uploaded resource after failed validation
Problem: When a file is uploaded using the FormUpload element, it is immediately saved to the resource collection upon form submission. However, if the file is later deemed invalid, it still occupies server storage, leading to unnecessary and potentially significant consumption of storage space.
Implementation: The \Neos\Form\Validation\FileTypeValidator now utilizes an injected resource manager. If a file fails validation, the resource manager deletes the corresponding file and entry in the DB, preventing invalid files from being permanently stored and conserving server storage space.
Thank you for this fix! I understand the problem and there might not be a good place to fix this, my only worry would be that this deletes the file in some cases but not in others (for example if the validation fails on something else and no resubmit happens).
I'll have a closer look.