Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

The current file upload size limit is 128MB. I want to reduce this to 1MB. I do not have access to php.ini file. I do have access to .htaccess and I could use this solution.

But why isn't there a method for doing this in the functions.php file?

** UPDATE **

So this, over at StackoverflowSo this, over at Stackoverflow, basically says why:

Those settings are not going to have any effect when set via ini_set

The reason is that PHP needs those values before your script is even executed. When an upload occurs, the target script is executed when the upload is complete, so PHP needs to know the maximum sizes beforehand.

Set them in php.ini, your virtual host config, or in a .htaccess file. A typical .htaccess file would look like this

php_value post_max_size 30M
php_value upload_max_filesize 30M

So the question remains; Is there a way to set max upload size in WP functions.php?

The current file upload size limit is 128MB. I want to reduce this to 1MB. I do not have access to php.ini file. I do have access to .htaccess and I could use this solution.

But why isn't there a method for doing this in the functions.php file?

** UPDATE **

So this, over at Stackoverflow, basically says why:

Those settings are not going to have any effect when set via ini_set

The reason is that PHP needs those values before your script is even executed. When an upload occurs, the target script is executed when the upload is complete, so PHP needs to know the maximum sizes beforehand.

Set them in php.ini, your virtual host config, or in a .htaccess file. A typical .htaccess file would look like this

php_value post_max_size 30M
php_value upload_max_filesize 30M

So the question remains; Is there a way to set max upload size in WP functions.php?

The current file upload size limit is 128MB. I want to reduce this to 1MB. I do not have access to php.ini file. I do have access to .htaccess and I could use this solution.

But why isn't there a method for doing this in the functions.php file?

** UPDATE **

So this, over at Stackoverflow, basically says why:

Those settings are not going to have any effect when set via ini_set

The reason is that PHP needs those values before your script is even executed. When an upload occurs, the target script is executed when the upload is complete, so PHP needs to know the maximum sizes beforehand.

Set them in php.ini, your virtual host config, or in a .htaccess file. A typical .htaccess file would look like this

php_value post_max_size 30M
php_value upload_max_filesize 30M

So the question remains; Is there a way to set max upload size in WP functions.php?

CurrentThe current file upload size limit is 128MB. I want to reduce this to 1MB. I do not have access to php.ini file. I do have access to .htaccess and I could use this solution.

But why isn't there a method where I can dofor doing this in the functions.php file?

** UPADATEUPDATE **

So this, over at Stackoverflow, basically says why:

Those settings are not going to have any effect when set via ini_set

The reason is that PHP needs those values before your script is even executed. When an upload occurs, the target script is executed when the upload is complete, so PHP needs to know the maximum sizes beforehand.

Set them in php.ini, your virtual host config, or in a .htaccess file. A typical .htaccess file would look like this

php_value post_max_size 30M
php_value upload_max_filesize 30M

So the question remains; Is there a way to set max upload size in WP functions.php?

Current file upload size limit is 128MB. I want to reduce this to 1MB. I do not have access to php.ini file. I do have access to .htaccess and I could use this solution.

But why isn't there a method where I can do this in the functions.php file?

** UPADATE **

So this, over at Stackoverflow, basically says why:

Those settings are not going to have any effect when set via ini_set

The reason is that PHP needs those values before your script is even executed. When an upload occurs, the target script is executed when the upload is complete, so PHP needs to know the maximum sizes beforehand.

Set them in php.ini, your virtual host config, or in a .htaccess file. A typical .htaccess file would look like this

php_value post_max_size 30M
php_value upload_max_filesize 30M

So the question remains; Is there a way to set max upload size in WP functions.php?

The current file upload size limit is 128MB. I want to reduce this to 1MB. I do not have access to php.ini file. I do have access to .htaccess and I could use this solution.

But why isn't there a method for doing this in the functions.php file?

** UPDATE **

So this, over at Stackoverflow, basically says why:

Those settings are not going to have any effect when set via ini_set

The reason is that PHP needs those values before your script is even executed. When an upload occurs, the target script is executed when the upload is complete, so PHP needs to know the maximum sizes beforehand.

Set them in php.ini, your virtual host config, or in a .htaccess file. A typical .htaccess file would look like this

php_value post_max_size 30M
php_value upload_max_filesize 30M

So the question remains; Is there a way to set max upload size in WP functions.php?

added 746 characters in body
Source Link
Steven
  • 2.6k
  • 7
  • 41
  • 61

Current file upload size limit is 128MB. I want to reduce this to 1MB. I do not have access to php.ini file. I do have access to .htaccess and I could use this solution.

But why isn't there a method where I can do this in the functions.php file?

** UPADATE **

So this, over at Stackoverflow, basically says why:

Those settings are not going to have any effect when set via ini_set

The reason is that PHP needs those values before your script is even executed. When an upload occurs, the target script is executed when the upload is complete, so PHP needs to know the maximum sizes beforehand.

Set them in php.ini, your virtual host config, or in a .htaccess file. A typical .htaccess file would look like this

php_value post_max_size 30M
php_value upload_max_filesize 30M

So the question remains; Is there a way to set max upload size in WP functions.php?

Current file upload size limit is 128MB. I want to reduce this to 1MB. I do not have access to php.ini file. I do have access to .htaccess and I could use this solution.

But why isn't there a method where I can do this in the functions.php file?

Current file upload size limit is 128MB. I want to reduce this to 1MB. I do not have access to php.ini file. I do have access to .htaccess and I could use this solution.

But why isn't there a method where I can do this in the functions.php file?

** UPADATE **

So this, over at Stackoverflow, basically says why:

Those settings are not going to have any effect when set via ini_set

The reason is that PHP needs those values before your script is even executed. When an upload occurs, the target script is executed when the upload is complete, so PHP needs to know the maximum sizes beforehand.

Set them in php.ini, your virtual host config, or in a .htaccess file. A typical .htaccess file would look like this

php_value post_max_size 30M
php_value upload_max_filesize 30M

So the question remains; Is there a way to set max upload size in WP functions.php?

Source Link
Steven
  • 2.6k
  • 7
  • 41
  • 61
Loading