• I have multiple forms where I need saving files to folder and linking to them. I have been trying to get the second code from: https://cfdbplugin.com/?page_id=794 to work but with no luck.
    I have this in the code in Shortcodes, actions and filters-plugin:

    // CHANGE THIS: CF7 form name you want to manipulate
        $formName = 'Myform';
     
        if ($formData && $formName == $formData->title) {
     
            // CHANGE THIS: directory where the file will be saved permanently
            $uploadDir = '/home/.../public_html/wp-content/uploads/sites/6/mydir/';
     
            // CHANGE THIS: URL to the above directory
            $urlDir = 'https://www.../mysite6/wp-content/uploads/sites/6/mydir/';
    
            // CHANGE THIS: upload field names on your form
            $fieldNames = array('myfile');

    This is what debug shows:

    [myfile] => /home/.../public_html/wp-content/uploads/sites/6/mydir/mydir-2.
    [myfile-url] => https://www.../mysite6/wp-content/uploads/sites/6/mydir/mydir-2.
    

    and these warnings:

    PHP Warning:  pathinfo() expects parameter 1 to be string, array given in /home/.../public_html/wp-content/plugins/add-actions-and-filters/AddActionsAndFilters_Executor.php(71) : eval()'d code on line 34
    PHP Warning:  copy() expects parameter 1 to be a valid path, array given in /home/.../public_html/wp-content/plugins/add-actions-and-filters/AddActionsAndFilters_Executor.php(71) : eval()'d code on line 54
    PHP Warning:  Parameter 1 to log_form_submissions() expected to be a reference, value given in /home/.../public_html/wp-includes/class-wp-hook.php on line 307

    File doesn’t get saved and path and URL changes to something-2 which doesn’t excist.
    What am I doing wrong?

Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Saving file to alternative location’ is closed to new replies.