I am using the image advanced field and lets say i upload a few images and decide to leave the page or part fill the form in, then there will be files stored in the media library which need removing as they are not being used. I say this as my website will be a free classified ads website and this could lead to lots of unused images to cleanup with no way to tell if they are being used.
Is there a way to delete the images from the media library if a user tried to close the page? I guess if there was a way to hook into the media upload when he user uploads files then this may help? so i can log the files being uploaded within the form prior to the form being submitted.
I do understand that the option to delete media when he user click on the X next to the image works fine, but this is not what i am referring to.
There is no way to delete the image when users leave the page without submitting the form with the field image_advanced. You can use the field image to achieve this goal, this field works like an HTML input file. It does not upload images to the media library if not submit the form. https://docs.metabox.io/fields/image/