Back to blog
6 min read Content Sync

“Maximum Upload File Size Exceeded” on WordPress Import: 4 Fixes

The WordPress Importer, and most other import screens, start by uploading a file. When that file is larger than the server allows, the import stops before it begins, with a message about upload_max_filesize or with the confusing “File is empty”. We reproduced the error on a test site with a 2 MB limit. Below: which setting is responsible, and four ways around it, from raising the limit to imports that never hit it.

Short Answer

The limit comes from PHP, not from WordPress. Raise upload_max_filesize and post_max_size in php.ini, .user.ini or the hosting control panel, or ask the host to do it. If that is not possible, import from the server’s disk with WP-CLI (wp import), which involves no upload, or use an importer that uploads in small chunks, such as the one in Import Export by RockStarLab.

The Error, Reproduced

The test site had upload_max_filesize = 2M and post_max_size = 8M, a common hosting default. The Tools → Import screen of the WordPress Importer shows the limit next to the file field:

WordPress Importer upload screen showing Maximum size 2 MB next to the file field
The import screen shows the upload limit next to the file field.

Uploading a 2.2 MB export file from another site was rejected right away:

WordPress Importer error Sorry, there has been an error. The uploaded file exceeds the upload_max_filesize directive in php.ini
A 2.2 MB file is rejected by the 2 MB limit.

The message, “The uploaded file exceeds the upload_max_filesize directive in php.ini”, names the setting that blocked it.

Which Setting Sets the Limit

Two PHP settings decide how large an uploaded file may be:

  • upload_max_filesize: the largest single file PHP accepts.
  • post_max_size: the largest whole request, file included.

WordPress shows the smaller of the two as “Maximum size”. During the test, one PHP process still had post_max_size = 1M from an earlier setting, and the import screen said “Maximum size: 1 MB” although upload_max_filesize was 2 MB.

When a file is larger than post_max_size, PHP discards the whole request, and WordPress cannot tell that a file was sent at all. The message is then “File is empty. Please upload something more substantial”, followed by a hint that post_max_size may be smaller than upload_max_filesize. It is the same problem with a misleading first sentence.

Fix 1: Raise the Limits

Where the settings live depends on the server:

  • Hosting control panel: many hosts offer a “PHP settings” or “MultiPHP INI Editor” page. This is the safest place.
  • php.ini on servers you manage yourself, followed by a restart of PHP.
  • .user.ini in the WordPress folder, on hosts that run PHP as PHP-FPM or CGI:
upload_max_filesize = 64M
post_max_size = 64M

Two things the test showed about .user.ini. First, PHP reads it only every five minutes by default (user_ini.cache_ttl = 300), so the new limit can take up to five minutes to appear, and different PHP processes switch over at different moments. Second, PHP also reads .user.ini files in subfolders: a file in /wp-admin/ overrides the one in the site root for every admin page, including the import screens. In the test, a forgotten /wp-admin/.user.ini kept the import screen at 1 MB long after the root file said 8 MB.

On Apache with mod_php, the same settings go into .htaccess as php_value upload_max_filesize 64M and php_value post_max_size 64M. On other setups that line causes an error 500, so try .user.ini first.

Fix 2: Import With WP-CLI

When the export file is already on the server, or can be copied there by SFTP, WP-CLI imports it from the disk. No upload takes place, so the upload limit does not apply. With the WordPress Importer plugin active:

wp import site-export.xml --authors=skip

On the test site, the 2.2 MB file that the upload form rejected was imported this way in 39 seconds, posts and media included. Use --authors=create or --authors=mapping.csv to control who the posts belong to.

Fix 3: Split the Export

Tools → Export can export one content type at a time, and posts by category or date range. Several smaller files, each below the limit, import one after the other. It works, but authors, terms and media are spread across the files, and a mistake in one part is easy to miss.

Fix 4: Use an Importer That Uploads in Chunks

The importer in Import Export by RockStarLab (Free) sends a file to the server in parts of 1 MB and puts it back together there. The upload limit applies to each part, not to the whole file.

For the test, all 868 posts of the old site were exported with the plugin as one JSON file of 3.89 MB, almost twice the 2 MB limit. On the new site, the file uploaded in 5 seconds and the preview showed all 868 rows.

Import Export by RockStarLab upload step at 100 percent for a 3.89 MB file
The 3.89 MB file uploaded in 1 MB parts despite the 2 MB limit.

The import of all 868 posts then finished in 1 minute 51 seconds with no failures.

Import result with 868 posts created, 0 failed and a duration of 1 minute 51 seconds
All 868 posts were imported in under two minutes with a batch size of 50.

For large files, raise Batch Size on the import options step. It sets how many rows are processed per step. With the default of 1, the same import ran at about one post every two seconds and would have needed close to half an hour; with 50, it took under two minutes.

Two limits remain. post_max_size still has to be larger than one part, so a host with post_max_size below about 1.1 MB needs Fix 1 anyway. And the chunked upload is for the plugin’s own files (CSV, JSON, XML, Excel, ODS and its migration packages). A WordPress Importer file (WXR) uploads, but is read as plain XML rather than as posts; import those with WP-CLI. For a whole site, the plugin’s Content Migration packs the content into a compressed ZIP: in another test, 2 MB of posts and pages became a 170 KB package.

Common Problems and Fixes

The limit did not change after editing .user.ini

Wait five minutes, then reload. If it is still the old value, look for another .user.ini in /wp-admin/, and check that the host runs PHP as FPM or CGI; with mod_php the file is ignored.

“File is empty. Please upload something more substantial”

The file is larger than post_max_size. Raise post_max_size to at least the value of upload_max_filesize.

The upload works but the import stops halfway

That is a different limit: max_execution_time or memory_limit. The WordPress Importer processes the whole file in one request. WP-CLI has no time limit by default, and importers that work in background batches avoid it as well.

Error 500 after adding php_value to .htaccess

The server does not run PHP as an Apache module. Remove the lines and use .user.ini or the control panel instead.

FAQ

Can a plugin raise upload_max_filesize?

Not directly. It is a PHP setting that is fixed before WordPress starts. Plugins that offer to raise it usually write to .htaccess or .user.ini, which only works on servers that read those files.

What values are reasonable?

For imports, 64 MB for both settings covers most sites. Set post_max_size equal to or larger than upload_max_filesize.

Does the limit also affect exports?

No. Downloading an export file is not an upload. The limit only matters on the site that receives the file.

Import Export by RockStarLab is free on WordPress.org.

Dmitriy
About author

Dmitriy

WordPress Developer with 15+ years of commercial experience. Elite Author on ThemeForest and creator of custom WordPress plugins. Passionate about clean code, performance optimization, and building useful tools for the WordPress community.

JOIN THE CONVERSATION

Comments 0

Have a question or a tip to share? Leave it below.

Leave a comment

Your email address will not be published. Required fields are marked *

We store your name, email and comment to show and moderate it; your email is never published. Spam protection is provided by Cloudflare Turnstile and profile pictures by Gravatar. See our Privacy Policy.


Try the plugin with no risks!

New users get 1 month with access to all premium features. Experience the most powerful WordPress data engine today.

Download Now
Get PRO for FREE