Title: Files loop error in CF7DBPlugin.php
Last modified: July 22, 2025

---

# Files loop error in CF7DBPlugin.php

 *  Resolved [davewoodhall](https://wordpress.org/support/users/davewoodhall/)
 * (@davewoodhall)
 * [10 months, 3 weeks ago](https://wordpress.org/support/topic/files-loop-error-in-cf7dbplugin-php/)
 * $filePath = $cf7->uploaded_files[$nameClean];
 * This returns an array despite having only one file.
 * I’ve fixed it with the following change :
 * if ($cf7->uploaded_files && isset($cf7->uploaded_files[$nameClean])) {
   $foundUploadFiles[]
   = $nameClean;$filePath = $cf7->uploaded_files[$nameClean];
 *     ```wp-block-code
                       if(!is_array($filePath))
                           $filePath = [$filePath];
   
                       if ($filePath) {
                           foreach($filePath as $fp) {
                               $content = file_get_contents($fp);
                               $didSaveFile = $wpdb->query($wpdb->prepare($parametrizedFileQuery,
                                   $time,
                                   $title,
                                   $nameClean,
                                   $valueClean,
                                   $order++,
                                   $content));
                               if (!$didSaveFile) {
                                   $this->getErrorLog()->log("CFDB Error: could not save uploaded file, field=$nameClean, file=$fp");
                               }
                           }
                       }
                   }
       ```
   

Viewing 1 replies (of 1 total)

 *  Plugin Author [Arshid](https://wordpress.org/support/users/arshidkv12/)
 * (@arshidkv12)
 * [10 months, 2 weeks ago](https://wordpress.org/support/topic/files-loop-error-in-cf7dbplugin-php/#post-18566851)
 * Sorry… you are using different plugin. Feel free to PM [support@ciphercoin.com](https://wordpress.org/support/topic/files-loop-error-in-cf7dbplugin-php/support@ciphercoin.com?output_format=md)

Viewing 1 replies (of 1 total)

The topic ‘Files loop error in CF7DBPlugin.php’ is closed to new replies.

 * ![](https://ps.w.org/contact-form-cfdb7/assets/icon-256x256.png?rev=1619878)
 * [Database Addon for Contact Form 7 - CFDB7](https://wordpress.org/plugins/contact-form-cfdb7/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-cfdb7/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-cfdb7/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-cfdb7/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-cfdb7/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-cfdb7/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Arshid](https://wordpress.org/support/users/arshidkv12/)
 * Last activity: [10 months, 2 weeks ago](https://wordpress.org/support/topic/files-loop-error-in-cf7dbplugin-php/#post-18566851)
 * Status: resolved