How to increase maximum upload file size in Prestashop
If you're trying to upload a theme/module that has a big package's file size on your Prestashop website, you might get an error: The file is too large. Allowed maximum size is 2 MB.
I believe this is not the first time you see this error and it will not be your last. But there are some easy solutions to to fix the upload_max_filesize error in Prestashop.
We have a new Prestashop module called DocumenThemix that helps you create professional, personalised Prestashop documents such as Invoices, Credit Slips or Delivery Slips in PDF that fit your brand, in seconds. It's a great module, and its file size is 7MB.
Sometime, the php configuration puts limits on upload file size. The default settings will restrict this to a max 2 MB upload file size. We need to increase this value to upload our favourite modules & themes.
First, we need to know about upload_max_filesize and 2 other values.
- Upload_max_filesize - The maximum length of an uploaded record.
- Memory_limit - This units the maximum quantity of memory in bytes that a script is permitted to allocate. This helps prevent poorly written scripts for eating up all to be had memory on a server. Note that to have no memory restriction, set this directive to -1.
- Post_max_size - Sets max size of post records allowed. In case you want to upload large files such as the premium Prestashop themes or Documenthemix module, this value should be large than upload_max_filesize. If reminiscence restriction is enabled by your configure script, memory_limit additionally affects document uploading.
Generally speaking, memory_limit need to be large than post_max_size.
I suggest two methods two fix this problem.
Edit the php.ini
Open php.ini file at /etc/php/apache2/php.ini or your-root-website/php.ini, search for the following variables and change these to:
memory_limit = 50M
upload_max_filesize = 10M
post_max_size = 10M
Some extra values to edit if you want a higher overall performance of your website on the server:
max_execution_time = 300
max_input_time = 600
memory_limit = 720M
Save the file and restart the apache web server!
If the first way does not work, or you don't have get right of entry to to the servers file system, for example: your web page is hosted on a commercial web server, then edit the .htaccess file in your web sites root.
Add these source codes into your .htaccess
php_value upload_max_filesize 10M
php_value post_max_size 20M
php_value memory_limit 32M
Save your file and enjoy your time.