Get Free Audit

Importing Images with Regional Symbols in the File Names in Prestashop

Sep 30, 2014

1124 Alex Simonchik

Importing Images with Regional Symbols in the File Names in Prestashop

Here is a small tip how to import images that use regional symbols in the file names, for example such as “Rødvin”.

The thing is that the default import is not able to upload pictures that have such characters in the name, that is why as a result you will see just a picture with a grey question mark instead of the product image. The problem is that AdminImportController::productImport() uses the URL of the image just as it is:

However, if you replace that line with this one:

Partner With Us Let's discuss how to grow your business. Get a Free Quote.
Talk to Andrey

This will fix the problem. I.e, you need to replace the variable ‘$url’ with ‘dirname($url) . ‘/’ .urlencode(basename($url)’.

Andrey Dubina
Partner With Us Looking for a partner to grow your business? We are the right company to bring your webstore to success. Talk to Andrey


  1. 1. If you look at the productImport() method you see that variable $url is «partially encoded» with $url = str_replace(‘ ‘, ‘%20’, $url); So if there was space in the original file name your encoding will corrupt it.

    2. You encode only the last part of the URL. But there can be more places to encode. Ex.: strange symbol folder/image name with some strange symbols.jpg

    3. Method call is not the correct place where to make such modifications.
    Update AdminImportController::copyImg() method. Change

    to the

    UPD: this patch was added to the Prestashop repo

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *