Jump to content

[Solved]How to change the length of the file name of the attachement?


Recommended Posts

  • 2 years later...
  • 4 weeks later...

Hi,

 

Does anyone know how to edit the filename length in 1.5?

I have looked every where but can't locate it.

 

Cheers.

 

if you want change length in 1.5 you need change in database varchar length (for example to 128) of column file_name in table {prefix}_attachment

 

next what you need to do is change two value in:

\controllers\admin\AdminProductsController.php

 

  if (!Validate::isGenericName(Tools::getValue('attachment_name_'.(int)($language['id_lang']))))
   $this->errors[] = Tools::displayError('Invalid Name');
  elseif (Tools::strlen(Tools::getValue('attachment_name_'.(int)($language['id_lang']))) > 32)
   $this->errors[] = sprintf(Tools::displayError('Name is too long (%d chars max).'), 32);
  if (!Validate::isCleanHtml(Tools::getValue('attachment_description_'.(int)($language['id_lang']))))
   $this->errors[] = Tools::displayError('Invalid description');

 

find this code and edit line with value set to 32 to value you have defined in database in my case there are line 371 and 372

 

after that open file \classes\Attachment.php

 

and change line 51

 

'name' =>    array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32)

 

 

with this same value as before in database and previous file

  • Like 2
Link to comment
Share on other sites

×
×
  • Create New...