Delete Files After Notifications Sent
This snippet will automatically delete all uploaded files after notifications have been sent. This pairs well with Gravity Forms’ “Attach uploaded fields to notification” notification option, allowing you to attach the files to a notification without preserving the files on the file server.
WARNING! Files will be deleted after submission regardless of whether notifications have been configured. Only use this snippet if you have configuration your notifications to attach the files.
Optionally, allow the submitter to decide if the files should be deleted or preserved by specifying a field ID and corresponding field value that confirms files should be deleted. For example, a Drop Down may have two choices: “Preserve Files” and “Delete Files”. Specify “Delete Files” as the $delete_value below and files will only be deleted if that choice is selected.
Instructions
Code
Filename: gw-delete-files-after-notifications-sent.php