WordPress媒体库10MB以上文件上传报错:文件仅部分上传
Let’s tackle this frustrating partial upload issue head-on—you’ve already tried the usual tweaks, so let’s dig into the less obvious culprits that might be blocking your large file uploads:
1. Verify Your PHP Settings Are Actually Applied
It’s surprisingly easy to edit the wrong php.ini file or forget to restart your server, leaving your changes unapplied. Here’s how to confirm:
- Create a file named
info.phpin your WordPress root directory with this code:<?php phpinfo(); ?> - Visit
yourdomain.com/info.phpin your browser, then search for these critical parameters:upload_max_filesize(must be larger than your target file size)post_max_size(needs to be at least 2xupload_max_filesize—e.g., if you’re uploading a 20MB file, set this to 40MB)memory_limit(aim for 128MB or higher to avoid memory exhaustion)max_execution_time(set to 300 or more to give the upload process enough time)max_input_time(match this tomax_execution_timeto prevent timeouts mid-transfer)
If any values don’t match what you configured, you’re likely editing the wrong php.ini file. Check with your host to find the correct file path for your site’s active PHP version.
2. Adjust Web Server Timeout Settings
Even if PHP’s timeouts are set correctly, your web server might cut off the connection early:
- Apache: Add this line to your
.htaccessfile (orhttpd.confif you have server access):Timeout 300 - Nginx: In your site’s server block configuration, add or update these lines:
client_max_body_size 64M; # Match or exceed your upload_max_filesize value proxy_read_timeout 300s;
Don’t forget to restart your web server after making these changes.
3. Rule Out Theme/Plugin Conflicts
Security plugins, performance tools, or custom theme code can sometimes override upload limits or interrupt transfers:
- Switch to a default WordPress theme (like Twenty Twenty-Four) and try uploading again.
- Disable all plugins, then re-enable them one by one to isolate which plugin is causing the issue. Pay extra attention to security plugins (e.g., Wordfence, iThemes Security) as they often include strict upload restrictions.
4. Check Server Disk Space
A full or nearly full server disk will always cause partial uploads:
- If you have SSH access, run this command to check disk usage:
df -h - In cPanel, use the "Disk Usage" widget to see if your account is near its storage limit.
5. Test Manual Upload via FTP
If the WordPress uploader is failing, try adding the file directly to your media library:
- Use FTP to upload your file to
wp-content/uploads/[current-year]/[current-month](create the folder if it doesn’t exist). - Go to your WordPress Media Library, click "Sync" or "Scan Files" (depending on your WP version) to let WordPress detect the new file.
If this works, the issue lies with the uploader process itself, not the file or server storage.
6. Check for Firewall/Security Module Blocks
Tools like ModSecurity or server-level firewalls might flag large file uploads as suspicious:
- Reach out to your hosting provider and ask them to check the ModSecurity logs for any blocks related to your upload attempts.
- Request a temporary disable of ModSecurity for your site to test (remember to re-enable it after troubleshooting!).
7. Eliminate Local Network Issues
Sometimes the problem is on your end:
- Try uploading from a different network (e.g., switch from Wi-Fi to Ethernet, or use a mobile hotspot).
- Test with a different device to rule out local connection instability.
内容的提问来源于stack exchange,提问作者amsterfran

