📤
Hosting

Can't upload a large file: upload_max_filesize and post_max_size

13.11.2026
← All articles

You try to upload a large photo, PDF catalogue or plugin archive in your site's admin area, and either you get "file exceeds the maximum upload size" or the form simply comes back empty with no error at all. Both usually come down to PHP upload limits. There are several of them and they depend on each other, so raising just one often changes nothing.

The settings that limit uploads

SettingLimitsPHP default
upload_max_filesizeSize of one file2M
post_max_sizeSize of the whole request8M
max_file_uploadsFiles per request20

post_max_size must always be larger than upload_max_filesize, because the file is only part of the request, and it must fit all files when a form sends several. The PHP manual also recommends that memory_limit be larger than post_max_size. For slow uploads max_input_time and max_execution_time matter too. Hosts usually raise these defaults, so check the actual values on your site.

Why the form comes back empty

When a request exceeds post_max_size, PHP does not parse it at all: $_POST and $_FILES are empty and the application cannot show a meaningful error. The log shows:

PHP Warning: POST Content-Length of 52428800 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

If the file exceeds only upload_max_filesize, the request arrives but $_FILES['file']['error'] is UPLOAD_ERR_INI_SIZE (1), which a good application should check and turn into a clear message telling the user the allowed size.

413 Request Entity Too Large

If PHP limits are fine but the browser shows 413 Request Entity Too Large, the web server rejected the request before PHP saw it. In Nginx this is client_max_body_size (1 MB by default); in Apache, LimitRequestBody. On shared hosting ask support; on your own VPS:

# inside the server block
client_max_body_size 64m;

sudo nginx -t && sudo systemctl reload nginx

Where to change the settings

On shared hosting use the PHP settings in the panel (ISPmanager, opened from the sayt.uz cabinet), or .user.ini when PHP runs under FPM or CGI. Change both values together:

upload_max_filesize = 64M
post_max_size = 72M
max_execution_time = 120

ini_set() cannot change these, because PHP receives and checks the request before your script starts. php_value in .htaccess works only with mod_php. In WordPress, the Media upload screen shows the effective maximum upload size.

Example: a college in Bukhara

A vocational college in Bukhara lets teachers upload materials on misol.uz. PDFs of 5-10 MB worked, but a 300 MB lecture video hung and returned an empty page because post_max_size was 64 MB. Raising the limit to 300 MB was not the right call: on a slow connection such an upload takes minutes, restarts from zero if interrupted and ties up server resources. The PDF limit stayed at 64 MB, and videos moved to a video platform with only the player embedded on the site.

Better options for very large files

Base your limits on the files your site really handles: 32-64 MB is usually enough for images and documents, and an oversized limit also lets abusers tie up the server with huge requests.

Related articles

⚡ Measuring Website Speed on Tas-IX: Commands and How to Read Results 🔌 Running WebSocket apps on hosting: shared hosting, VPS and Nginx setup 🐢 MySQL Slow Query Log: Finding the Query That Slows Your Site 📦 Moving Away from Plesk: What to Take and What Not to Forget
🌐 Language
🇺🇿 O'zbek 🇺🇿 Ўзбек 🇷🇺 Русский 🇬🇧 English ✓