File upload fieldPro
An advanced drag-and-drop uploader for images, PDFs and other files, with type, size and count limits.
The File field lets users upload one or more files: photos, PDFs, documents. Users drag files into the box or click Browse. This is a Pro field.
Settings
| Setting | What it does |
|---|---|
| Label, Required, Help Text, Class | As in other fields |
| Name | Meta key |
| Accept | Allowed file types, comma separated. Default image/*,application/pdf. Examples: image/*, .pdf,.docx, video/mp4. |
| Max File Size | Maximum size of one file in KB. Default 500 (0.5 MB). |
| Max Files | Maximum number of files. Default 3. |
| Attach to post | Attach the uploaded files to the post in the Media Library (default on) |
| Placeholder | Text in the upload box. Default “Drag & Drop your files or Browse” |
| Label texts | About 30 texts of the uploader (“Uploading”, “Upload complete”, “File is too large”, …). Change them to translate the uploader. |
How files are saved
Files are uploaded to the Media Library as soon as the user adds them. When the post is saved, the list of attachment IDs is saved as post meta under the field Name.
Good to know
- WordPress also has its own list of allowed file types. A type in Accept that WordPress does not allow is still rejected.
- For security, HTML, SVG, XML and JavaScript files are always rejected, and uploaded files are served as downloads.
- Your server has an upload size limit too (
upload_max_filesizein PHP). Max File Size cannot be higher than that.