2

I've done numerous WP sites, written my own plugins, run my own server, etc etc.

But I have not seen this before. I just installed a fresh 4.7.1 and installed the Proto theme and all its plugins.

When I went to add media files, I got:

Maximum upload file size: 2 KB.

I deactivated all plugins one by one...no dice. My PHP memory limit is set to 256MB for this installation via wp_config.php.

Googling the 2 KB limit turned up no results.

Anyone seen this before or know how to fix this limit?

  • 1
    Does this happen only when it's setup that way or for any and all WP installs? This is very likely to not be a WP issue but a general PHP/Server issue, the memory limit and the upload limits are separate and completely different things – Tom J Nowell Jan 17 '17 at 15:57
4

Three things you need to check.

upload_max_filesize, memory_limit and post_max_size in the php.ini configuration file exactly.

All of these three settings limit the maximum size of data that can be submitted and handled by PHP.

Typically post_max_size and memory_limit need to be larger than upload_max_filesize.


This is the function in WordPress that defines the constant you saw:

File: wp-includes/media.php
2843: /**
2844:  * Determines the maximum upload size allowed in php.ini.
2845:  *
2846:  * @since 2.5.0
2847:  *
2848:  * @return int Allowed upload size.
2849:  */
2850: function wp_max_upload_size() {
2851:   $u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
2852:   $p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
2853: 
2854:   /**
2855:    * Filters the maximum upload size allowed in php.ini.
2856:    *
2857:    * @since 2.5.0
2858:    *
2859:    * @param int $size    Max upload size limit in bytes.
2860:    * @param int $u_bytes Maximum upload filesize in bytes.
2861:    * @param int $p_bytes Maximum size of POST data in bytes.
2862:    */
2863:   return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );
2864: }
1

Try to paste this code below in all .htaccess in root of folder :

Options -Indexes
php_value upload_max_filesize   1000M
php_value post_max_size         1000M
php_value max_execution_time    300
php_value max_input_vars        1600
0

Had the same issue with new installs this week. You need to set the upload limits on your php.ini, if you are on a shared server you need to create a file called .user.ini then paste the code below

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300
0

There is a plugin "Max Upload Size" that will let you easily increase the size of uploads. Fairly lightweight. See https://wordpress.org/plugins/upload-max-file-size/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.