Monday, January 3, 2011

PrestaShop Tips - why upload_max_filesize not changing

At PrestaShop back office adminCatalog page, you are able to upload product file for down loadable products. But most store owners are frustrated with default 2M file size limit. Because they don't how to change upload_max_filesize so that they can upload larger files.

I was one of those frustrated, but finally I solved my problem so I post my experience to share with others.

I was using WAMP windows version.

1. In configuration file /config/config.inc.php, there is following line try to change the parameter of upload_max_filesize

@ini_set('upload_max_filesize', '100M');
@ini_set('default_charset', 'utf-8');

But these two line usually seem not working, because not all PHP parameters are changeable by ini_set() command. Please see below for a list of parameters that you can change by ini_set().

http://www.php.net/manual/en/ini.list.php

2. At AdminCatalog.php page, there are following default definitions. It seems that you are able to upload maxFileSize is 10000000 (10M). But you still can not upload more than 2M size file.

protected $maxImageSize = 2000000;
protected $maxFileSize = 10000000;

3. I found this parameter defined in following php.ini file.
C:\wamp\bin\php\php5.3.0\

I changed this from default 2M to 10M or more, it still doesn't work.

4. Some people say that you can run phpinfo() in php script to see what php.ini is effect. I tried, in my environment it pointed c:\windows\php.ini, but underthis folder php.ini does not exists at all.

5.Finally,I found another php.ini in following folder
C:\wamp\bin\apache\Apache2.2.11\bin

I changed the parameter in php.ini under this folder, finally it worked for me.

Conclusion:
A. There are many places that set parameter upload_max_filesize, but only one place php.ini will work for you. You need to find out all php.ini

B. Every time you make changes on php.ini file, you need to restart WAMP service to make it effect.

C. If your site is hosted by ISP, I suggest you contact your ISP.


-----------------------------------------------------
Looking for stable/bug-less and more features Paypal payment module for your PrestaShop? I recommend Agile Paypal Express Checkout.




Agile Paypal is a Paypal Express Checkout module for PrestaShop. It is very stable and bug-less PrestaShop Paypal module. Among many other features, Express Checkout that allow customer checkout without sign up/log in. This module will redirect customer to Paypal payment page in less than 3 clicks. See more detail here http://addons-modules.com/