I'm trying to import some products from a csv with images that are stored on an external server. The images are saving to the var/import folder ok but they won't assign to the product. I'm using the google logo to test. The exception.log file says: main.CRITICAL: File 'var/import/googlelogo_color_272x92dp.pnggooglelogo_color_272x92dp.png' was not found or has read restriction. {"exception":"[object] (Magento\\Framework\\Exception\\LocalizedException(code: 0): File 'var/import/googlelogo_color_272x92dp.pnggooglelogo_color_272x92dp.png' was not found or has read restriction. at /home/account/public_html/vendor/magento/module-catalog-import-export/Model/Import/Uploader.php:210)"} [] See how it's concatenating the file name twice? What's going on? The import works fine if I use a local path but goes screwy when I put an external url in the source. For the record the image source is: https://www.google.co.uk/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png

I've tried the same file on a different installation of 2.3 and got the same result. The same file worked perfectly on 2.2.6

2 Answers 2


I overwrote /vendor/magento/module-catalog-import-export/Model/Import/Uploader.php with the version from 2.2.6 and it worked fine.

  • You should not overwrite files in vendor folders directly. Did you write a patch for it, can you share it?
    – arnoudhgz
    Commented Dec 11, 2019 at 9:18

I compared both files Magento 2.X and Magento 2.3 and got the issue related to this.

Please open this file /vendor/magento/module-catalog-import-export/Model/Import/Uploader.php There is missing one condition in function setTmpDir() and here is the missing code with line by line

  1. missing to use

    use Magento\Framework\App\ObjectManager; http://prntscr.com/mfvnv8 on line no : 10

  2. missing code on line no 99 to 102


    • @var \Magento\Framework\App\Filesystem\DirectoryResolver */ private $directoryResolver;
  3. missing code on line no 135 $this->directoryResolver = $directoryResolver ?: ObjectManager::getInstance()->get(\Magento\Framework\App\Filesystem\DirectoryResolver::class);

  4. missing code on line no 112

    • @param \Magento\Framework\App\Filesystem\DirectoryResolver|null $directoryResolver
  5. missing to add code in __construct() \Magento\Framework\App\Filesystem\DirectoryResolver $directoryResolver = null

  6. missing code on line no 134 $this->directoryResolver = $directoryResolver ?: ObjectManager::getInstance()->get(\Magento\Framework\App\Filesystem\DirectoryResolver::class);

  7. Missing code in line no 294

    Old code public function setTmpDir($path) { if (is_string($path) && $this->_directory->isReadable($path)) { $this->_tmpDir = $path; return true; } return false; }

    • Replace it with below code

    public function setTmpDir($path) { if (is_string($path) && $this->_directory->isReadable($path) && $this->directoryResolver->validatePath($this->_directory->getAbsolutePath($path), DirectoryList::ROOT) ) { $this->_tmpDir = $path; return true; } return false; }

Hope, This one is useful to understand you why this is not uploading.

Thank you

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.