• Resolved deob

    (@deob)


    Contact 7 5.4 made a major change to file uploads and files are are no longer being saved in the cf7-database folder. Are you fixing this soon?

    • This topic was modified 3 years, 9 months ago by deob.
    • This topic was modified 3 years, 9 months ago by deob.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Bruce

    (@ninjateamwp)

    Hi @deob ,

    Thanks for using database plugin, please allow me to forward this to our developers and we will fix this issue asap.

    Kind regards,
    -Bruce-

    Plugin Support Bruce

    (@ninjateamwp)

    Hi @deob,

    I am back as promised!
    So, please note that we cannot update a new version right now it will take some time before we do.

    Now, here is how you could fix the issue:
    – Go to this file wp-content\plugins\cf7-db\frontend\save-files.php
    – replace with this;

    <?php
    if ( ! defined('ABSPATH') ) {
        exit('Direct\'s not allowed');
    }
    //save files uploaded by user and modify data before inserting to database
    add_filter('cf7d_modify_form_before_insert_data', 'cf7d_modify_form_before_insert_data_cb');
    if ( ! function_exists('cf7d_modify_form_before_insert_data_cb') ) {
        function cf7d_modify_form_before_insert_data_cb( $cf7 ) {
            //if it has at least 1 file uploaded
            if ( is_object($cf7) && isset($cf7->uploaded_files) && count($cf7->uploaded_files) > 0 ) {
                $upload_dir         = wp_upload_dir();
                $cf7d_upload_folder = cf7d_upload_folder();
                $dir_upload         = $upload_dir['basedir'] . '/' . $cf7d_upload_folder;
                wp_mkdir_p($dir_upload);
                foreach ( $cf7->uploaded_files as $k => $v ) {
                    $file = $v;
                    if(is_array($file)) $file = $file[0];
                    $file_name = basename($file);
                    $file_name = wp_unique_filename($dir_upload, $file_name);
                    $dst_file  = $dir_upload . '/' . $file_name;
                    if ( @copy($file, $dst_file) ) {
                        $cf7->posted_data[ $k ] = $upload_dir['baseurl'] . '/' . $cf7d_upload_folder . '/' . $file_name;
                    }
                }
            }
            return $cf7;
        }
    }

    I hope this helps!
    Thank you.

    Kind regards,
    -Bruce-

    Thread Starter deob

    (@deob)

    Hi Bruce,

    For some reason I did not see the email saying your responded. Sorry for the slow response.

    The code did not work. Nothing is being saved.

    Couple of items that may change your code.

    Your plugin is entitled cf7-database not cf7-db so the folder path is cf7-database/frontend.

    Also, the data in the database only lists the file name but I figure that is all related.

    Another item that you may considering in your next update. We have hidden fields because they are too long and want to be able to easily see all the form submissions without having to scroll alot (we will have a few hundred). However, when you export only visible fields are exporting. Having an option to export all fields no matter what fields are visible in the dashboard would be nice as we always want to export all fields.

    Plugin Support Bruce

    (@ninjateamwp)

    Hi @deob ,

    We checked this case and the file upload works well for us, could you please record a short screencast or take a screenshot for us to show how it does not work for you?

    Regarding the other suggestion of yours about exporting data! Please note that the UX is best the way it is, where hidden fields are not exported, so I hope if you want to scroll through the database, you need to hide the empty fields and when you want to export, you need to unhide them.

    Thank you!

    Kind regards,
    -Bruce-

    Thread Starter deob

    (@deob)

    First off, I don’t agree with your reply to my suggestion. Going through and hiding and un-hiding fields is a pain. All you need to do is add a check box that states export hidden fields. It would be a much better interface. On a large form that has many fields, unhiding and hiding fields is very cumbersome. As well, a large form is difficult to scroll through in the WordPress dashboard without hiding fields to make it more manageable for a quick reference.

    You can look at the directory for my test site, I have it open for you.

    https://www.gqcccquiltshow.org/oshine/wp-content/uploads/cf7-database/

    No images are showing up in the directory. Also, normally the link shows in the database field and it is showing only a name and not the link.

    I have included screen shots here for you https://www.gqcccquiltshow.org/oshine/wp-content/uploads/cf7-database/screenshots/

    I am using another extension Smart Grids and they needed to update to handle the new Contact Form 5.4 upload code. You extension only works if I do not update Contact Form to 5.4.

    Plugin Support Bruce

    (@ninjateamwp)

    Hi @deob ,

    Your suggestion regarding the database export is well taken and has been forwarded to our developers for possible consideration.

    Regarding the other issue, we still do not experience that issue on our end now even though we are using latest version of our plugin and that of CF7 itself.

    So, in this case, I would suggest that you please schedule a Team check with our developers for help:

    [email protected]

    Thank you!

    Kind regards,
    -Bruce-

    Plugin Support Bruce

    (@ninjateamwp)

    Hi @deob ,

    Also, as a point of note, we just released a new version of the plugin that fixes a lot of issue, please check and I hope it helps!

    Thank you.

    Kind regards,
    -Bruce-

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘File uploads not working with new Contact 7 5.4 update’ is closed to new replies.