WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7 Multi-Step Forms
File attachments (10 posts)

  1. akimet-inc
    Member
    Posted 1 year ago #

    Everything works fine for me with the "Contact Form 7 Multi-Step Forms" plugin except the attachments. I'm not receiving them via email. I'm using the corresponding tag such as [your-form] in the "File attachments:" section and [form your-form] in the "Form" section. But I'm still not receiving the attachments in the confirmation emails. Any suggestions?

    http://wordpress.org/plugins/contact-form-7-multi-step-module/

  2. webheadllc
    Member
    Plugin Author

    Posted 1 year ago #

    I haven't tested the form with attachments. It should work if you put the file attachments on the last step.

  3. thepofo
    Member
    Posted 5 months ago #

    I have the same issues, did you find a solution?

  4. akimet-inc
    Member
    Posted 5 months ago #

    Yes. The "File attachments" only work on the very last page.

  5. thepofo
    Member
    Posted 5 months ago #

    mmmm, did that and not working. Diving in again.

  6. thepofo
    Member
    Posted 5 months ago #

    Solved, managed to do this manually, by copying the attachment to a temp spot on the server

  7. KamyP
    Member
    Posted 4 months ago #

    Hi thepofo,

    I have the same problem.
    Can you said me how have you make to copying the attachment to a temp spot on the server ??

    I search this solution.

    Thx a lot.

  8. thepofo
    Member
    Posted 4 months ago #

    Hello KamyP

    Basically you could use this example:

    First you make sure you have the right Contact form you execute the code on:
    The id is the id of your form, in this example 119

    add_action( 'wpcf7_before_send_mail', 'save_application_form');
    
    function save_application_form($cf7) {
    if ($cf7->id==119){
    // ADD YOUR CODE HERE
    }
    }

    Then the file copy by itelf

    add_action( 'wpcf7_before_send_mail', 'save_application_form');
    
    function save_application_form($cf7) {
    if ($cf7->id==119){
    $values = $cf7->posted_data;
    
    $uploadedFile = $values['file'];
    
    $srcfileextrainfo = '/path/to/your/wpcf7_uploads/'.$uploadedextrainfoFile;
    $dstfileextrainfo = '/path/to/your/destination/folder/'.$uploadedextrainfoFile;
    
    copy($srcfileextrainfo, $dstfileextrainfo);
    
    }
    }

    That way the file is copied to the temp folder. The wpcf7 uploads folder is usually found under "www/wp-content/uploads/sites/9/wpcf7_uploads" where 9 is the number of your site.

    In the final form, before sending you do the same as above, only using the id of the last form and adding following:

    $cf7->uploaded_files = array ( 'file' =>  'path/to/your/file.ext');

    Don't forget to put the file variable (or whatever you name it to the attachments list in contact form 7 form config.

    Contact Form 7 automatically deletes the files, so you don't have to worry about leftover files

    Hope this helps,.

    Eric

  9. Russ Powers
    Member
    Posted 4 months ago #

    Hey Eric,

    Tried your example but not sure if I'm getting it right. Can you provide a better example if possible? Like what exact code goes in the form that accepts the attachments, and the exact code that goes in the form that sends the email? This would be very helpful :)

    Thanks!

  10. Russ Powers
    Member
    Posted 4 months ago #

    Also are these codes added to .php files for either the extension or contact form 7 itself? Or are we adding it to the "additional settings" text box at the bottom of the edit form page?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic