• Resolved davewoodhall

    (@davewoodhall)


    $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];

                    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)
Viewing 1 replies (of 1 total)

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