Tuesday, May 24, 2011


In this article, we will discuss about Enhancing File UPLOAD LIMIT.

Set Upload File Size Limit your php installation putting limits on upload file size. The default will restrict you to a max 2 MB upload file size. You need to set the following three configuration options: - upload_max_filesize - The maximum size of an uploaded file. - memory_limit - This sets the maximum amount of memory in bytes that a script is allowed to allocate. This helps prevent poorly written scripts for eating up all available memory on a server. Note that to have no memory limit, set this directive to -1. - post_max_size - Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. If memory limit is enabled by your configure script, memory_limit also affects file uploading. Generally speaking, memory_limit should be larger than post_max_size.

There are two methods two fix this problem.

2.1. php.ini configuration - Locate the php.ini file used by your web server. You can use the phpinfo() PHP function to find it. - find and modify next parameters: memory_limit = 32M upload_max_filesize = 10M post_max_size = 20M - restart Apache

2.2. .htaccess configuration - This is useful when you do not have access to php.ini file. Edit (Create) the.htaccess file in the site root (public) directory and add the following line: php_value upload_max_filesize 10M php_value post_max_size 20M php_value memory_limit 32M This method will only work if PHP is running as an Apache module.

development, apps development india