Jump to content

Possible bug uploading attachments: invalid file


Recommended Posts



I'm having the next problem in a Prestashop


When I'm in the product panel and I attach a file in attachments (for example .pdf) I receive the error Invalid file.


It only occurs when I attach a file using the product panel, if I use the main attachments panel there isn't problem.


The error is launched in AdminProductsController.php line 679.

if (empty($this->errors)) {
} else {
 $_FILES['attachment_file']['error'][] = Tools::displayError('Invalid file');

It only occurs with heavy files, for example 5MB if I try with a 100KB file, the problem disappears.


The server has post_max_size and upload_max_filesize to 64 MB. So I think the problem isn't caused by the server configuration.


Should I report it in the forge?, Do you know a solution?




Best regards.


Link to comment
Share on other sites

Hi Tuk, I solved it.


Doing the next:

$_FILES['attachment_file']['error'][] = Tools::displayError('Invalid file ' . implode(" ", $this->errors));

The error shown was:


"El archivo subido excede el tamaño para un producto descargable, establecido en preferencias (2MB) o la directiva post_max_size/ en php.ini (2MB)".


In Administration -> preferences I changed the max size of uploaded files and the problem was solved.


In next versions of Prestashop, it would be nice if it showed this error, "invalid file" is so generic. Should I report this to the forge?




Best regards.

Edited by FranciscoVillen (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...