0

I'm wondering if there is a code for functions.php that can increase upload size for files once is required by user session. I need to increase this limit only when the user requests to upload a file, not in the php.ini or .htaccess as general rule (for security issues).

Example: A user must upload one file of 250 MB or 5 files of 50 MB without having time outs.

My .htaccess limits are:

php_value upload_max_filesize 16M
php_value post_max_size 16M
php_value max_execution_time 300
php_value max_input_time 300

I'm using Wordpress 4.4.2 with Genesis Child theme.

I need some code in functions.php that can increase temporarily this limit on session start of each upload request. Thank you for you time! Hope to find someone that know this trick.

Cheers! :-) Daniel

jhoepken
  • 1,842
  • 3
  • 17
  • 24
Daniel
  • 13
  • 1
  • 1
    This question is already answered here [max execution time](http://stackoverflow.com/questions/7739870/increase-max-execution-time-for-php) – dogstring Mar 23 '16 at 09:34

2 Answers2

1

Please try following lines in functions.php

@ini_set( 'upload_max_size' , '250M' );

@ini_set( 'post_max_size', '250M' );

@ini_set( 'max_execution_time', '1000' );

Gaurav Jariwala
  • 523
  • 2
  • 12
0

1) for function.php file

@ini_set( 'upload_max_size' , '64M' );

@ini_set( 'post_max_size', '64M');

@ini_set( 'max_execution_time', '300' );

2) for php.ini file

upload_max_filesize = 64M

post_max_size = 64M

max_execution_time = 300

3) for .htaccess file

php_value upload_max_filesize 64M

php_value post_max_size 64M

php_value max_execution_time 300

php_value max_input_time 300

vishal patel
  • 329
  • 1
  • 11