Contact Form 7 File Upload Word Document

In this post, I will explain the file uploading and zipper feature of Contact Form 7. With this feature, yous tin permit your users to upload their files via your form, and then an email with attachments of the files is sent to you.

To set up, two steps are needed: 1) Add file uploading fields in your form, 2) Gear up your mail settings to attach the uploaded files. The ii steps volition exist explained in the remainder of this post.

Adding file uploading fields in your form

Similar for other types of class fields, Contact Class 7 provides form-tags for file uploading fields (<input type="file"> in HTML): file and file*. file* is a required field and requires the user to upload a file.

Selection Examples Description
id:(id) id:foo id aspect value of the input element.
grade:(class) course:bar class attribute value of the input element. To set two or more than classes, you lot can apply multiple form: option, like [file your-file class:y2008 grade:m01 class:d01].
filetypes:(filetypes) filetypes:gif|png|jpg|jpeg Adequate file types. List the file extensions after filetypes:, and separate them with '|' (piping) character when y'all ready multiple file types.
limit:(num) limit:1048576
limit:1024kb
limit:1mb
Limit the max file size acceptable. You can utilize kb (kilo byte) or mb (mega byte) suffix optionally. If you omit suffix, the number ways bytes. Annotation that y'all can't utilise a decimal point in it (i.e., like this: [file your-file limit:i.5mb]) and it will be ignored if it exists.

Example:

[file your-file filetypes:pdf|txt limit:2mb]

Contact Form 7 applies default restrictions for file type and file size when you practice non fix the filetypes: and limit: (file size) options explicitly. Default acceptable file types (extensions) are: jpg, jpeg, png, gif, pdf, md, docx, ppt, pptx, odt, avi, ogg, m4a, mov, mp3, mp4, mpg, wav, and wmv. Default acceptable file size is i MB (1048576 bytes).

Setting up file attachments with an email

To attach the uploaded files to the postal service, put mail-tags corresponding to grade-tags for file uploading fields into File attachments field in the Mail service tab console like shown beneath:

Screenshot of File Attachment field
Screenshot of File Zipper field

In this instance, the form-tag for the file uploading field is:

[file your-file filetypes:pdf]

Therefore, the respective postal service-tag to this is:

[your-file]

Note that what you lot put in the File attachments field is [your-file] (mail-tag), not [file your-file filetypes:pdf] (this is not a postal service-tag only a form-tag).

If you have multiple files uploaded and want to attach them into an email, simply line the mail-tags upward in the File attachments field similar this:

[your-file][your-another-file]

Local file zipper

Contact Grade 7 supports local file attachment. You tin put local file paths in the File attachments field and those files will be attached to the e-mail as well equally uploaded files.

Put a file path per line. When the path is non an absolute path, information technology will be treated every bit a relative path to the wp-content directory.

For security reasons, specifying files outside of the wp-content directory for electronic mail attachments is not immune, so place the files in the wp-content or its subdirectory.

Case:

[your-file][your-some other-file] uploads/2013/08/08/boringguide.pdf

How your uploaded files are managed

After a user uploads a file through your contact form, Contact Course 7 checks to see if: 1.) Whatsoever PHP errors take occurred; 2.) the file blazon and file size are valid; so, if the check turns out okay, Contact Form 7 moves the uploaded file to a temporary folder. At this point, Contact Course vii attaches the file to the postal service and sends information technology. Afterward these procedures, Contact Grade 7 then removes the file from the temporary folder.

The location of the temporary folder is wp-content/uploads/wpcf7_uploads by default. It may differ if you take inverse upload path setting from wp-content/uploads.

This folder is created automatically, but sometimes it tin fail. The well-nigh possible reason for this is that the parent folder doesn't have sufficient writing permissions. In such cases, you lot can change the permissions or create a binder manually.

You can customize this directory path by defining the WPCF7_UPLOADS_TMP_DIR constant like the post-obit:

ascertain( 'WPCF7_UPLOADS_TMP_DIR', 'your-custom-tmp-dir' );              

Y'all can set the abiding value to an accented directory path or a relative path to the WordPress content directory (WP_CONTENT_DIR). Be aware that, even in cases where you set it to an absolute directory path, yous can only specify a directory that is located nether the content directory. Otherwise, the abiding volition be ignored.

Merely some other contact form plugin for WordPress. Elementary merely flexible.

piercerephy1945.blogspot.com

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

0 Response to "Contact Form 7 File Upload Word Document"

Postar um comentário

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel