Breaking News
Home / Web / PHP / PHP Snippets / How to allow PHP to upload larger file size (audio etc.)?

How to allow PHP to upload larger file size (audio etc.)?

The following parameters can to be changed in php.ini in order to allow upload of larger files.

ini_set(‘upload_max_filesize’, ’20M’);

ini_set(‘post_max_size’, ’20M’);

ini_set(‘max_input_time’, 300);

ini_set(‘max_execution_time’, 300);

The first two parameters are related to max size in MB of the uploaded file and the second two are related to how much execution time in secs is allowed for the php script. This max time can be determined by increasing to a higher number and uploading the file of max size (2OMB in this case) and counting the time it takes for it to upload. Then adjust the execution time parameter to say 20 to 40% more of that value to accommodate network slowness or bandwidth congestion that may happen at times of high load.

Once the parameters are changed, restart your webserver for these to take effect. Then test the upload.<!>

[pb_builder]

Check Also

How to rename file in PHP?

If you want to rename a file in PHP you can use the rename function. …

Advertisment ad adsense adlogger