wordpresscontact-form-7

Save Attachment Contact Form 7


I'm working in WordPress with Contact Form 7. I'm dynamically creating a Word Document based on the users submitted data, and I want to save that file to the server that the user is sent from Contact Form 7.

But i can not see the files anywhere. Where i am wrong?

I have the following code at the moment:

<h3 class="anchor">PLEASE UPLOAD COPIES OF YOUR MEDICAL CARD AND CDL . </h3>
<label> Here is my medical card:
    [file step_2_medical_card_upl filetypes:doc|docx|pdf|jpg|jpeg|png] </label>

<label> Here is my CDL:
    [file step_2_cdl_upl filetypes:doc|docx|pdf|jpg|jpeg|png] </label>

and in mail tab i added [step_2_medical_card_upl] and [step_2_cdl_upl] . The files are in email, but not in server. How to save them?


Solution

  • Contact Form 7 moves the uploaded file to a temporary folder. At this point, Contact Form 7 attaches the file to the mail and sends it. After these procedures, Contact Form 7 then removes the file from the temporary folder.

    Ref: https://contactform7.com/file-uploading-and-attachment/

    It calls remove_uploaded_files() after procedures which have no filter to stop it. So apparently what you want here, isn't meant to be done by the author of CF7.