Skip to content

WordPress form file uploads not working — PHP, permissions, and security

Fix WordPress form file uploads that fail with a vague error, reject certain file types, or stop working after a server move. Check the PHP and nginx size limits first, then folder permissions, the form plugin's allowed file types, and security plugin rules.

When the file-upload field on a WordPress form fails, the cause is almost always one of four settings, and checking them in order usually finds it. Typical signs are a 2 MB image that works while a 12 MB one fails, PDFs that upload while Word files do not, or every upload failing after a server move. Start with PHP’s size limits, upload_max_filesize and post_max_size (plus nginx’s body limit if nginx sits in front), which reject a large file before WordPress sees it and so produce a vague error. Next, wp-content/uploads/ must be owned by, and writable by, the user PHP runs as. Last come the form plugin’s list of allowed file types and any security plugin, such as Wordfence, that blocks file extensions it treats as risky.

What’s happening

Each form plugin writes uploads to wp-content/uploads/<plugin>/<form-id>/ and that directory must exist and be writable by the PHP user. PHP itself rejects files above upload_max_filesize before any plugin code runs — the user sees a vague error because the request never reached WordPress. Plugins additionally enforce a MIME-type whitelist that does not always match what the browser sends, so a .heic from an iPhone might be rejected as application/octet-stream. Wordfence, iThemes, and similar plugins block any extension on a “dangerous” list, which silently rejects valid documents.

How to verify

Check PHP limits, directory permissions, and recent upload attempts:

wp eval 'echo ini_get("upload_max_filesize") . " / " . ini_get("post_max_size") . " / " . ini_get("max_file_uploads");'
ls -la wp-content/uploads/ | head -5
stat -c "%U:%G %a %n" wp-content/uploads/gravity_forms wp-content/uploads/wpforms wp-content/uploads/fluentform 2>/dev/null
tail -f wp-content/debug.log
tail -f /var/log/nginx/error.log

In dev tools, try a known-good upload and watch the request size — a 413 from nginx or 500 from PHP-FPM points at upload limits, not the plugin.

The fix

  1. Raise PHP limits: in the PHP-FPM pool config or .user.ini, set upload_max_filesize = 64M, post_max_size = 80M, max_execution_time = 300. Restart PHP-FPM after editing pool config.
  2. Raise nginx body limit: in the server block, add client_max_body_size 80m; and reload nginx. Without this, large uploads return 413 before reaching PHP.
  3. Fix uploads ownership: chown -R <php-user>:<php-user> wp-content/uploads && find wp-content/uploads -type d -exec chmod 755 {} \; && find wp-content/uploads -type f -exec chmod 644 {} \;. Replace <php-user> with the actual PHP-FPM user (often www-data or the cPanel account).
  4. Add MIME types: in the plugin’s upload-field settings, list allowed extensions explicitly. For HEIC, add heic,heif. For modern Office docs, confirm docx,xlsx,pptx are present.
  5. Whitelist in security plugins: in Wordfence > Firewall > Allowlisted URLs, add the form’s submission endpoint. In iThemes Security, allow the upload directory.
  6. Test with a real device: do not trust browser dev tools to reproduce mobile uploads — iPhone HEIC, Android WebP, and old Windows screenshots each behave differently.

For WordPress sites where forms collect contracts, expense receipts, or RFP attachments, upload reliability is part of our enterprise WordPress hosting scope. To audit upload paths and limits across your forms, book a scoping call.