Search code examples
phpprestashopprestashop-1.7prestashop-modules

PrestaShop Addons size limited to 50Mb with a hardcoded value?


I was trying to upload a custom module to prestashop 1.7, and get this error:

File is too big (52.59MiB). Max filesize: 50MiB.

I've checked with phpinfo that it's not caused by my php settings:

memory_limit 512M

post_max_size 150M

upload_max_filesize 100M

Searching on the web, I find that this value seems to be hardcoded on the file:

adminblahblahblah/themes/default/js/bundle/module/module.js

One of its lines says:

maxFilesize: 50, // can't be greater than 50Mb because it's an addons limitation

But editing that value, donesn't seem to do nothing.

It's really hardcoded this value and is an addons limitation? or can be changed and how?

Thanks for your help!


Solution

  • Yes, it's hardcoded!

    It's hardcoded in a javascript file, quite similar to the one you found.

    This is the file here the limitation is:

    [admindir]/themes/new-theme/public/module.bundle.js

    Just search for "maxFilesize", and you will find: maxFilesize:50 (no space between : and 50).

    That's the limitation that acts when you try to upload a module. It's javascript, so the check is made before really uploading the file.

    Changing that value in that file will do the job.

    There are a few more files where is declared a file upload limitation, but the one mentioned is the guilty when uploading modules.

    Tested in PrestaShop v.1.7.8.7