Attached files not being deleted

Hi, I have just taken on support for a client that uses Gravity Forms and one of the first things they asked me about was why their host company was giving a warning about disk space (80%+ usage).
When I looked I found that the biggest offender was the “gravity_forms” folder and in there a whole load of files. When I dug deeper I find that their form asks for file attachments (they are an engineering company and their clients send them technical specs via the form).
So I thought “Easy - check with the user and see what form entries I can delete and the files will get deleted too” - WRONG: they told me I could delete almost all of them and left just 10 that they were looking to deal with soon. I deleted the entries and then emptied the “trash” through your admin panel but the files still persist!
I found another guy on this forum had the same issue and was talking about the “auto purge” feature but this is not enabled on my client - but the expert’s response was “manually delete them and them empty the trash and the files will go”.
So I just submitted a new form, waited for the client to tell me they had received the email (with the file attachment) and then deleted the entry and emptied the trash - my file is still there (in the gravity_forms folder structure).
They are running v2.7.12 which I believe is the latest.
Obviously I can use the host’s CPanel file manager and go clear up some space but I am a bit concerned about (a) this needs resolving and (b) I may delete files that the plugin needs to be in this folder (4 of the folders contain images of numbers that are used for CAPTCHA I assume, most dating back to Jun 2022)
Thanks in anticipation

It’s been over a week without a reply so thought I would bump this up - does anyone have any idea why attached files are not being deleted when we delete the entry and empty the trash please?

Hi @richardw8k , sorry to tag you but it appears you did help someone else with file attachment issues and wondered if you could look at this one for me? Basically I have entries with files attached, when I delete the entry and empty the trash the entry goes but the file(s) remain on the server. Clearly the code has access to create the files so I do not think it is a permissions issue, wondered what else I can look at please? Thanks. Dik.

@fixitdik for a prompt response, you’d be best to open a support ticket on These community forums can be good for crowdsourcing a solution from like-minded users, but not so much for potential server configuration or code conflicts.

My recommendation – as a fellow Gravity Forms users – would be to do some simple debugging to narrow down the problem yourself, and then provide those results in the support ticket you open with Gravity Forms:

  1. Follow the instructions in Gravity Forms Theme and Plugin Conflict test article
  2. Once you’ve enabled conflict testing, and only have the default WordPress theme + Gravity Forms enabled, create a new test form with a File Upload field (configure it as either a single or multi-file field, matching your problem form).
  3. Preview the form and submit a test entry with a file uploaded
  4. Go to the Entry Details page and verify the file uploaded successfully
  5. Locate that same file on your filesystem using FTP or a File Manager. It’ll be in the /wp-content/uploads/gravity_forms/{form_id}-{hash}/ directory
  6. Go to the Entry List page of your test form and delete the entry
  7. Select the “Trash” link in the Filter Toolbar and then use the “Empty Trash” button
  8. Verify the file on disk has been deleted

If the above works as expected, double check those entries you deleted have been permanently deleted from the trash. If the trash is empty on your problem form, it’s likely you have a theme or plugin conflict that prevented the uploads from being deleted. But to make sure, run the exact same test again, but this time do it on the original problem form. If the file is deleted in both cases, it’s a conflict.

Got a conflict? Unfortunately that means you need to enable each plugin one at a time and re-run the test until it breaks. When it breaks, the last plugin enabled is the conflict. If you enable all plugins without issue, it’s likely a conflict with custom code in your theme. Switch back to your original theme and test again.

WordPress: the software of a million possibilities… and a million potential conflicts. I wish you all the best with your :lady_beetle: bug hunt!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.