File uploads are powerful but dangerous. Every uploaded file is a potential security risk—malicious scripts, malware, or exploits disguised as innocent documents. Restricting file types is your first line of defense against upload-based attacks. In this guide, you’ll learn how to secure your WordPress form file uploads by allowing only safe, necessary file types. Unrestricted uploads invite attacks: Attacker uploads malicious.php disguised as image.php. If executed, they gain server control. Attacker uploads resume.pdf.exe. User sees “PDF,” downloads and runs executable. Malware hidden inside seemingly normal document. Opens and infects systems. Allow only what you need. Block everything else. Note: Avoid .svg unless necessary—it can contain scripts. Here’s how to restrict file types with Auto Form Builder: Select only the categories you need: For fine-grained control, specify exact extensions: Secure File Uploads Needed: Resume, cover letter Allow: Block: Everything else Max size: 5 MB Needed: Screenshots, logs Allow: Block: Everything else Max size: 10 MB Needed: High-quality images Allow: Block: Everything else (including .gif, .webp if not wanted) Max size: 15 MB Needed: Various documents Allow: Block: Everything else Max size: 10 MB Needed: Optional attachments Allow: Block: Everything else Max size: 5 MB Client-side restrictions can be bypassed: Verify file content matches extension: For high-security applications: Where files are stored matters: Don’t keep original filenames: Restrict what uploaded files can do: Method: file.pdf.php Prevention: Check final extension only, validate MIME type Method: file.php%00.jpg Prevention: Sanitize filenames, modern PHP versions are protected Method: Send PHP file with image/jpeg header Prevention: Check actual file content, not just headers Method: File valid as both image and script Prevention: Re-process/re-save images, strip metadata Method: Tiny ZIP expands to huge size Prevention: Size limits, careful archive handling WordPress has built-in allowed file types: Protect wp-content/uploads: Add to uploads folder: Error messages shouldn’t help attackers: Only what you actually need. For most forms: PDF for documents, JPG/PNG for images. Add other types only when specifically required. Generally yes—PDFs can’t execute server-side code. They can contain embedded scripts that run on user devices, but this is lower risk than executable files. Only if necessary. ZIP files can contain anything, including malicious files. If you allow them, don’t automatically extract, and scan contents before use. No—SVG can contain JavaScript. Block SVG unless you have a specific need and sanitize them before use. Allow .doc/.docx/.xls/.xlsx but block .docm/.xlsm/.pptm (the “m” indicates macro-enabled). Have them ZIP the file (if you allow ZIP), or use alternative submission methods (email, cloud storage link). Don’t compromise security for convenience. Securing file uploads with type restrictions: File upload security starts with restricting what types of files users can upload. By allowing only necessary, safe file types—and blocking everything else—you eliminate most upload-based attack vectors before they start. Auto Form Builder makes file type restrictions simple with category-based and extension-based controls. Select what you need, and dangerous file types are automatically blocked. Ready for secure file uploads? Download Auto Form Builder and configure safe, restricted file uploads for your forms.Secure File Uploads: Restricting File Types in WordPress Forms
Why File Type Restrictions Matter
Security Threats
Real Attack Scenarios
Scenario 1: PHP Web Shell
Scenario 2: Double Extension
Scenario 3: Embedded Malware
The Principle
Dangerous File Types to Block
Always Block These
Extension
Type
Risk
.exe
Windows executable
Runs malicious programs
.php
PHP script
Server-side code execution
.js
JavaScript
Browser code execution
.bat, .cmd
Windows batch
Command execution
.sh
Shell script
Linux command execution
.phtml, .php5
PHP variants
Server-side execution
.asp, .aspx
ASP scripts
Server-side execution
.jsp
Java Server Pages
Server-side execution
.cgi, .pl
Perl scripts
Server-side execution
.htaccess
Apache config
Server configuration changes
.dll
Dynamic library
Code injection
.scr
Screensaver
Actually executable
.msi
Installer
Installs software
High-Risk File Types
Extension
Risk Level
Consideration
.html, .htm
Medium
Can contain scripts
.svg
Medium
Can contain JavaScript
.xml
Medium
XXE vulnerabilities
.zip, .rar
Medium
May contain anything
.docm, .xlsm
Medium
Macro-enabled Office files
Safe File Types to Allow
Images (Generally Safe)
Extension
Type
Notes
.jpg, .jpeg
JPEG image
Most common photo format
.png
PNG image
Supports transparency
.gif
GIF image
Animated images
.webp
WebP image
Modern web format
.bmp
Bitmap
Uncompressed image
Documents (Generally Safe)
Extension
Type
Notes
.pdf
PDF document
Most common document format
.doc, .docx
Word document
Avoid .docm (macros)
.txt
Plain text
Very safe
.rtf
Rich text
Generally safe
Spreadsheets
Extension
Type
Notes
.xls, .xlsx
Excel spreadsheet
Avoid .xlsm (macros)
.csv
Comma-separated values
Plain data, very safe
Configuring File Type Restrictions
Step 1: Add File Upload Field
Step 2: Configure Allowed Types
By Category
Specific Extensions

Step 3: Set Additional Security
File Size Limits
File Count Limits
File Type Restrictions by Use Case
Job Application Form
Support Ticket Form
Photo Contest Form
Document Submission Form
General Contact Form
Additional Security Measures
1. Server-Side Validation
2. MIME Type Checking
3. File Content Scanning
4. Secure Storage Location
5. Randomized File Names
6. File Permissions
Common Attack Vectors & Prevention
Attack: Double Extension
Attack: Null Byte Injection
Attack: Content-Type Spoofing
Attack: Polyglot Files
Attack: ZIP Bombs
WordPress-Specific Security
WordPress Allowed MIME Types
Upload Directory Security
.htaccess Protection
# Disable PHP execution
<FilesMatch "\.ph(p[3-7]?|tml)$">
Deny from all
</FilesMatch>
Testing Your File Restrictions
Test Valid Files
Test Invalid Files
Test Edge Cases
Error Messages for Users
Good Error Messages
Bad Error Messages
Don’t Reveal Too Much
Frequently Asked Questions
What file types should I allow?
Is PDF safe to allow?
Should I allow ZIP files?
Are SVG files safe?
How do I block macro-enabled Office files?
What if users need to upload a blocked file type?
Summary
Conclusion
Learn how to bulk delete form submissions in WordPress. Remove multiple entries at once to clean up spam, test data, and old submissions efficiently.
Master WordPress form submission management. Learn to view, filter, search, star, export, and organize form entries like a pro with this complete guide.
Learn how to search and find form submissions in WordPress. Filter by date, form, status, and search across all submission data.
Comparing Auto Form Builder and Contact Form 7 for WordPress. See which form plugin offers better ease of use, features, and value for your website.
Learn how to view, organize, search, filter, and export your WordPress form submissions. Complete guide to submission management.
Learn why storing form data on your own server helps with GDPR compliance. Choose form plugins that keep your user data local and under your control.
Learn how to filter WordPress form submissions by date. Find entries from specific time periods quickly using date range filters.
Learn how to bulk edit, delete, and manage form submissions in WordPress. Save time with mass actions on multiple entries at once.
Learn how to restrict date fields to future dates only for event registration forms. Block past dates and set booking windows in WordPress.
Learn how to create quantity fields in WordPress forms. Collect numbers for guests, items, tickets, and more with proper validation and limits.
Learn how to star and flag important form submissions in WordPress. Prioritize leads, mark urgent requests, and organize your form entries effectively.
Learn how to set up email notifications for your WordPress forms so you never miss a submission. Step-by-step guide with Auto Form Builder.