Back to Community

How to Manage and Troubleshoot File Uploads in Contact Form 7 Database Addon (CFDB7)

38 threads Sep 16, 2025 PluginContact form 7 database addon – cfdb7

Content

Struggling with how CFDB7 handles your uploaded files? You're not alone. A common theme across support forums for the Contact Form 7 Database Addon – CFDB7 is confusion and troubleshooting related to file uploads. This guide consolidates the most frequent issues and their solutions, based on community discussions.

How CFDB7 Handles File Uploads

Unlike form data, which is stored serialized in your WordPress database, uploaded files are not saved in the database itself. Instead, the plugin stores them as physical files on your server. When a user submits a form with a file field, the plugin performs two actions:

  1. It saves the form's text data (like name, email, etc.) into the WordPress database.
  2. It moves the uploaded file to a specific folder on your server and saves a reference link to that file location in the database.

Where to Find Uploaded Files

The default location for all files uploaded through your forms is:

/wp-content/uploads/cfdb7_uploads/

You can access this folder via your hosting account's File Manager or an FTP client. Within this directory, files are automatically renamed for uniqueness. The 'Contact Form 7 Database Addon – CFDB7' plugin adds a timestamp prefix (e.g., 1597108435-foto.jpg) to the original filename to prevent overwrites if two files have the same name.

Common File Upload Issues and Solutions

1. The Download Link in Exports or Emails Doesn't Work

Problem: You export entries to a CSV file, but the link to the uploaded file is broken and returns a "Page Not Found" error. Similarly, trying to use the [filename] tag in a CF7 email body results in a link to the original filename, which doesn't exist.

Why it happens: The link points to the original filename (e.g., foto.jpg), but the actual file on the server has a timestamp prefix (e.g., 1597108435-foto.jpg).

Solution: This is a known limitation of the plugin. The stored file reference includes the timestamp, but the default mail tags may not. To display a working link in a Contact Form 7 email, you would need custom code to retrieve the correct, renamed file path from the database and make it available as a custom mail tag.

2. Files Are Not Attached to the Admin Email

Problem: You want the uploaded file to be attached to the email notification sent to the site admin.

Solution: This is a function of Contact Form 7, not CFDB7. In your CF7 form settings, go to the Mail tab. In the File attachments field, add the name of your file upload field enclosed in brackets (e.g., [your-file]). CF7 will then attach the file to the email.

3. Need to Display a Download Link in the Email Body

Problem: The uploaded file is too large to send as an email attachment, so you want to insert a download link in the body of the notification email instead.

Why it happens: The plugin does not have a built-in shortcode or mail tag for this purpose.

Solution: Implementing this requires custom development. A developer would need to create a function that hooks into the form submission process, retrieves the renamed file's path, and creates a custom mail tag (e.g., [_your-file-url]) that you can then use in your email template.

4. Security and File Access Concerns

Problem: The cfdb7_uploads folder is publicly accessible, which is a concern for sensitive documents.

Solution: The 'Contact Form 7 Database Addon – CFDB7' team suggests adding an empty index.php file to the folder to prevent directory browsing. For stronger security, you can add an .htaccess file (on Apache servers) to the folder to restrict access. A common method is to deny all access:

Order Deny,Allow
Deny from all

Important: If you completely block access via .htaccess, the download links in the CFDB7 admin panel will also stop working. This method is only recommended if you have another way to retrieve the files (e.g., via FTP).

5. Potential File Overwrite Bug

Problem: A user reported a potential edge-case bug where if two files with the same name are uploaded at the exact same second, one could overwrite the other due to the timestamp prefix being identical.

Solution: This issue was identified by a community member. The suggested code fix involves modifying the plugin's core file to include an additional unique identifier alongside the timestamp. Warning: Modifying core plugin files is not recommended, as your changes will be overwritten the next time the plugin updates. This fix would need to be officially implemented by the plugin author.

Conclusion

Understanding that CFDB7 stores files separately from the database is key to troubleshooting. The most common issues revolve around the renamed files and the lack of built-in mail tags for their URLs. For simple tasks like finding your files, check the cfdb7_uploads folder. For more advanced functionality like secure links in emails, custom coding is currently required.

Related Support Threads Support