Mates1122 Posted July 20, 2010 Share Posted July 20, 2010 Hi,I have the following problem: If I want to add an attachment to some goods I always receive this message: the field mime is too long (32 chars max) could somebody help me to fix it??Thanks a lotMatt Link to comment Share on other sites More sharing options...
JayDatamex Posted December 23, 2010 Share Posted December 23, 2010 Me too. I was trying to upload MS Office 2007 documents, e.g. a Word doc with a .docx extension, and it was being rejected every time. Apparently the mime types for these documents can be up to 74 characters long! Here's a list (source: http://www.bram.us/2007/05/25/office-2007-mime-types-for-iis/).docm,application/vnd.ms-word.document.macroEnabled.12.docx,application/vnd.openxmlformats-officedocument.wordprocessingml.document.dotm,application/vnd.ms-word.template.macroEnabled.12.dotx,application/vnd.openxmlformats-officedocument.wordprocessingml.template.potm,application/vnd.ms-powerpoint.template.macroEnabled.12.potx,application/vnd.openxmlformats-officedocument.presentationml.template.ppam,application/vnd.ms-powerpoint.addin.macroEnabled.12.ppsm,application/vnd.ms-powerpoint.slideshow.macroEnabled.12.ppsx,application/vnd.openxmlformats-officedocument.presentationml.slideshow.pptm,application/vnd.ms-powerpoint.presentation.macroEnabled.12.pptx,application/vnd.openxmlformats-officedocument.presentationml.presentation.xlam,application/vnd.ms-excel.addin.macroEnabled.12.xlsb,application/vnd.ms-excel.sheet.binary.macroEnabled.12.xlsm,application/vnd.ms-excel.sheet.macroEnabled.12.xlsx,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.xltm,application/vnd.ms-excel.template.macroEnabled.12.xltx,application/vnd.openxmlformats-officedocument.spreadsheetml.templateTo get it working, I had to edit the ps_attachment table and set the field length to 74. Next, open up the Attachment.php file (it's in the classes dir) and edit line 26 where it says: protected $fieldsSize = array('file' => 40, 'mime' => 32); just change this to protected $fieldsSize = array('file' => 40, 'mime' =>74); and you should be good to go! Link to comment Share on other sites More sharing options...
vivek tripathi Posted April 18, 2013 Share Posted April 18, 2013 (edited) Hi I am using prestashop version 1.5.4 solution mentioned in this post is not working Edited April 18, 2013 by vivek tripathi (see edit history) Link to comment Share on other sites More sharing options...
vivek tripathi Posted April 18, 2013 Share Posted April 18, 2013 Hi I have got crack to increse attachment name length for prestashop version 1.5.4 STEP 1 Go to classes/Attachment.php find the code near line no 50 'name' =>array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32), Replacede with 'name' =>array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128), STEP 2 go to controllers\admin\AdminProductsController.php Find the function processAddAttachments() inside that fuction find code near line no 463 elseif (Tools::strlen(Tools::getValue('attachment_name_'.(int)($language['id_lang']))) > 32) $this->errors[] = sprintf(Tools::displayError('The name is too long (%d chars max).'), 32); Replace width elseif (Tools::strlen(Tools::getValue('attachment_name_'.(int)($language['id_lang']))) >128) $this->errors[] = sprintf(Tools::displayError('The name is too long (%d chars max).'), 128); STEP 3 Open database table ps_attachment_lang change name field varchar(32) to varchar(128) 1 Link to comment Share on other sites More sharing options...
vitochueng Posted March 7, 2014 Share Posted March 7, 2014 Great! I just followed your methods to change the tags length. It works well... By the way, it no need to do the step 2 when I changed the tags length.. Thanks a lot! Link to comment Share on other sites More sharing options...
Wandito Posted April 4, 2014 Share Posted April 4, 2014 Perfect! Many thanks. Link to comment Share on other sites More sharing options...
tzimismarinatos Posted January 3, 2015 Share Posted January 3, 2015 How to fix for ps 1.6 Link to comment Share on other sites More sharing options...
markovo Posted June 4, 2016 Share Posted June 4, 2016 (edited) Its the same, except for STEP 2 STEP 2go tocontrollers\admin\AdminProductsController.php at line 601 to 604 : if (!Validate::isGenericName($name)) { $_FILES['attachment_file']['error'][] = sprintf(Tools::displayError('Invalid name for %s language'), $language['name']); } elseif (Tools::strlen($name) > 32) { $_FILES['attachment_file']['error'][] = sprintf(Tools::displayError('The name for %1s language is too long (%2d chars max).'), $language['name'], 32); change to : if (!Validate::isGenericName($name)) { $_FILES['attachment_file']['error'][] = sprintf(Tools::displayError('Invalid name for %s language'), $language['name']); } elseif (Tools::strlen($name) > 128) { $_FILES['attachment_file']['error'][] = sprintf(Tools::displayError('The name for %1s language is too long (%2d chars max).'), $language['name'], 128); That worket for me! Edited June 4, 2016 by markovo (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now