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?
4 Answers
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: }