• Resolved rcostica

    (@rcostica)


    Hello,

    I’ve been using Contact Form 7 on many sites and would like to thank you for this great plugin, but I’ve ran into a bit of a problem on the latest site.

    I am using contact form 7 for an inquiry form and sending the visitor 2 local files attached to the reply email. The function I used is this:

    function my_dynamic_attachments($cf7)
    {
     $submission = WPCF7_Submission::get_instance();
     $submission->add_uploaded_file('toe', get_template_directory().'/attachment1.pdf');
         $submission->add_uploaded_file('ep', get_template_directory().'/attachment2.pdf');
    }
    add_action( 'wpcf7_before_send_mail', 'my_dynamic_attachments', 10 );

    The problem I am facing is that the attachments are deleted from the server after the email is sent, thus they are not available for the next visitor. I have also tried just adding one of the files as attachment the regular way, by inserting its path in the attachments section, but I got the same behaviour – the file got attached, sent and then deleted from the server.

    Looking at submit() in WPCF7_Submission there is a call to remove_uploaded_files() which has no filter to stop it.

    Is there any way to solve this?

    https://www.ads-software.com/plugins/contact-form-7/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Prevent local attachment from being deleted’ is closed to new replies.