Sometimes you need to upload large files. But the default file upload size settings restrict you to upload large files. PHP default setting allowed only 2MB file upload size.
So if you want to upload large file, then you need to set the following configuration into your your php.ini 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.
upload_max_filesize – The maximum size of an uploaded file.
post_max_size – This 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.
There are two methods two fix this problem.
php.ini file usually stored in /etc/php.ini or /etc/php.d/cgi/php.ini or /usr/local/etc/php.ini on linux server. On WAMP SERVER, PHP.INI file is stored in wamp/bin/php/php.ini.
OR you can also Edit .htaccess file residing on your root directory. This is useful when you do not have access to php.ini file.
- php_value upload_max_filesize 10M
- php_value post_max_size 20M
- php_value memory_limit 32M