Documentation / Tutorials / Tutorials & How to’s
Upload the file
/ Tutorials & How to’s / Upload the file
If you want to upload file from your form use below code:
Here, we are showing example while you are using form entries CPT.
- You have to generate custom fields to upload the file, which have field type as file.
- Write the form field as:
<input type="file" class="form-control-file" id="attach_certifications" aria-describedby="fileHelp" name="attach_certifications">
- Add above code to your form handler:
[aw2.upload post_id='{{aw2.get module.enquire_id}}' attach_to_post upload_element_id='attach_certifications' set="module.attach_certifications"] [aw2.get attachment_url attachment_id='{module.attach_certifications}' /]
where, post_id is current post id whatever you set to the posts elements.
- If you want to get the URL of the uploaded file write above code in your handler:
[aw2.get function.wp_get_attachment_url p1="{module.attach_certifications}" set="module.crt_url" /]