Methods of Increasing file upload size in PHP

It often becomes a major headache to continue file uploading in PHP due to limitations in maximum file upload size. Increasing memory limits in PHP and increasing PHP upload size are two completely different worlds of determinations. Default option allows PHP upload size be limited between 2MB to 10MB. Most servers are developed on PHP scripts which make it open to initiate changes in upload limits. Errors are common with developers finding it hard to select higher upload sizes. We have given a few steps which can help to ensure increasing file upload size in PHP.


Configuration Options
The following configurations need to be set in order to prepare the increase in upload limitation. ‘upload_max_filesize’ is a command that ensures increasing the upload file size. ‘memory_limit’ allow developers to set maximum limits within the script. This allows the desired file size to be allocated. This is a very important command that helps preventing poorly written scripts to take up larger memories on servers. In order to erase memory limit directive for this command must be set to -1. post_max_size

Code that Ensures Increasing of File Upload Limit There are few common codes and commands that help in increasing file upload size in PHP> Given below are a few choices: php_value upload_max_filesize 40M php_value post_max_size 42M
Above mentioned command increases PHO file upload limit only if the server allows .htaccess to make changes in PHP configuration. .htaccess files are stored along with .php files in the same directory. Configuration can be modified for the folder that contains the file and all other sub-folders. A .htaccess file needs to be created in the directory of your choice and the process of configuration can be followed. The final step includes writing the above mentioned command that invariably implements the change.

Edit php.ini
Php.ini gets stored in /etc/php.ini or /etc/php.d/cgi/php.ini or /usr/local/etc/php.ini. These files need to be edited to increase the upload limit. # vi /etc/php.ini wil be the command for achieving this.
ini_set function is another way of achieving the means of increasing upload limit. The following command will ensure the right output. However before writing the below mentioned command php.ini must be changed:
ini_set('post_max_size', '64M');
ini_set('upload_max_filesize', '64M')
Recent PHP versions contain ini-settings as PHP_INI_PERDIR do not allow setting them into a script.

Common causes affecting file uploading in PHP
Setting memory limits affect file uploading in PHP. While working in WordPress ‘wp-config.php file’ needs to be modified to make changes in file uploading limit. PHP files not uploaded on ASCII will affect file uploading. All PHP file types such as .txt, .cfg, .sql, .html, .inc must be uploaded in ASCII mode. PHP settings must not be set to low values as it affects file uploading. Errors in version of files are another common cause affecting file uploading. Erroneous entry in Database data often affects PHP file uploading limit. Every single detail entered must be in order and checked multiple times. Server side script developed on PHP affects in increasing PHP file uploading.

This article is contributed by ValueCoders, an outsourcing company india through which you can hire HTML programmers, .Net programmers and WordPress programmers. One can also hire PHP programmershere for effective PHP development services.

Comments

Popular posts from this blog

How to show only month and year fields in android Date-picker?

How to construct a B+ tree with example

Conflict Serializability in database