Search code examples
magento

Increase Max length of image name of Magento 2.3.5 error message:(was not uploaded. Filename is too long; must be 90 characters or less)


When I import product data or I upload image directly to a product I get the following message (was not uploaded. Filename is too long; must be 90 characters or less)

Recently my magento has been updated and I didn't have this problem before.

Does anyone know how I can increase the number of characters slightly?

enter image description here


Solution

  • I was able to solve the problem myself.

    The file in question is located in the following folder vendor\magento\framework\File Uploader.php

    search for the following code:

    // account for excessively long filenames that cannot be stored completely in database
    if (strlen($fileInfo['basename']) > 90) {
        throw new \InvalidArgumentException('Filename is too long; must be 90 characters or less');
    

    Adjusting this file is not the best method, I have to add