Support » Plugin: Contact Form 7 Multi-Step Forms » File attachments

  • 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/

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author webheadcoder

    (@webheadllc)

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

    thepofo

    (@thepofo)

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

    Thread Starter akimet-inc

    (@akimet-inc)

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

    thepofo

    (@thepofo)

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

    thepofo

    (@thepofo)

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

    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.

    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

    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!

    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?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘File attachments’ is closed to new replies.