Jump to content

[Partially Solved] Contact form attached files


Recommended Posts

  • 2 weeks later...

Hi, you need to modify controllers/front/ContactController.php file, do a research on $extension term in postProcess function, you will find:

$extension = array('.txt', '.rtf', '.doc', '.docx', '.pdf', '.zip', '.png', '.jpeg', '.gif', '.jpg');

if you want add .rar, add it in the array like that

$extension = array('.txt', '.rtf', '.doc', '.docx', '.pdf', '.zip', '.png', '.jpeg', '.gif', '.jpg', '.rar');
Link to comment
Share on other sites

  • 3 weeks later...

Do you or any one know why it dont send .ai and .psd extensions wich are the adobe illustrator and photoshop extensions?

In the case of .ai my site reset the contact form page and show the mesage that the extension is wrong but in the .psd case it send the mesage but no attachment on it.
The rest of them that i setup did work fine as .rar, .tif, .eps and .svg

Link to comment
Share on other sites

For  add .ai files change in the same controller function this

elseif (!empty($file_attachment['name']) && !in_array(Tools::strtolower(substr($file_attachment['name'], -4)), $extension) && !in_array(Tools::strtolower(substr($file_attachment['name'], -5)), $extension))
$this->errors[] = Tools::displayError('Bad file extension')

for this

elseif (!empty($file_attachment['name']) && !in_array(Tools::strtolower(substr($file_attachment['name'], -4)), $extension) && !in_array(Tools::strtolower(substr($file_attachment['name'], -5) && !in_array(Tools::strtolower(substr($file_attachment['name'], -3)), $extension))
$this->errors[] = Tools::displayError('Bad file extension'); 
Edited by ventura (see edit history)
  • Like 1
Link to comment
Share on other sites

but that is for the bad file message apears when someone send me a .ai file? Yes that is

or that makes me receive them? and do you know something about psd, it send the mesage like its correct but no file atached on it?psd format it´s atached also

 

Try with this code

$extension = array('.txt', '.psd', '.doc', '.docx', '.pdf', '.zip', '.png', '.jpeg', '.gif', '.jpg', '.psd', '.ai');

and this

else if (!empty($fileAttachment['name']) && !in_array( Tools::strtolower(substr($fileAttachment['name'], -3)), $extension) && !in_array( Tools::strtolower(substr($fileAttachment['name'], -4)), $extension) && !in_array( Tools::strtolower(substr($fileAttachment['name'], -5)), $extension))
$this->errors[] = Tools::displayError('Bad file extension');
  • Like 2
Link to comment
Share on other sites

  • 3 months later...

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...