Jump to content

[ISSUE] Customer Contact Form Upload File not accessbile in Backend 403


Recommended Posts

Hi all,

 

next problem seeing with Presta 1.6.0.6 after upgrade from 1.4.8

 

If a customer sends a message via the contact form and attaches a file to it.

The File is not accessible at backend, I will get error 403.

 

I checked the pload folder it has chmod 0755 but the files in there only have 0600 why?

Also changing to 777 did not have any effect.

 

After changing the files to 640 they were accessible.

Is there a php code missing to set the files to 0640 like for normal product image upload?

 

 

Regards

 

Link to comment
Share on other sites

Okay found there it happen in controllers/front/ContactController.php

find:

if (isset($fileAttachment['rename']) && !empty($fileAttachment['rename']) && rename($fileAttachment['tmp_name'], PS_MODULE_DIR.'../upload/'.basename($fileAttachment['rename'])))
    $cm->file_name = $fileAttachment['rename'];

and change it to:

if (isset($fileAttachment['rename']) && !empty($fileAttachment['rename']) && rename($fileAttachment['tmp_name'], _PS_MODULE_DIR_.'../upload/'.basename($fileAttachment['rename'])))
                        {
                            $cm->file_name = $fileAttachment['rename'];
                            $file= _PS_MODULE_DIR_.'../upload/'.basename($fileAttachment['rename']);
                            chmod($file, 0640);
                        }

 

Link to comment
Share on other sites

×
×
  • Create New...