8

I am importing products using the built in CSV import (System - import - products)

All my data is imported fine, but I get an error "Imported resource (image) could not be downloaded from external resource due to timeout or access permissions in rows: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10"

in my css I have written the base_image path as http://mywebsite.ca/pub/media/import/img/hose/jpg/Ach7938.jpg

as a test I removed my folder structure, edited the csv and tried this and got same problem, same error http://mywebsite.ca/pub/media/import/Ach7938.jpg

I tried writing file path as so /pub/media/import/img/hose/jpg/Ach7938.jpg but it won't let me past the "check data" validator.

I confirmed the permissions on the folders and files is 775

I am using php 5.6, I tried 7 but it broke the whole site in many different ways, so that isn't an option

As a side note, if I run this 20 times in a row, the entire site hangs and import won't work again until I do a full system restore (whats up with that?)

Can I put the images on a different server and link to them that way?

6

the image path should be something like this in the csv: Ach7938.jpg

M1 would then search for the image file in media/import so I think it would be pub/media/import in M2

You could create a product with an Image and then export the data to get a clue how the value in the csv has to be

5

I got the error mentioned as "Imported resource (image) could not be downloaded from external resource due to timeout or access permissions" when I used following format of csv file to import image in Magento 2.0.0 version(Windows 10).

The format of csv which I used was as following >>

sku,base_image,errors
WT09-XS-Purple,/pub/media/import/wt09-white_back-test.jpg

and under the File to import section's sub section Images File Directory I used the path as /pub/media/import

I had the image to be imported at pub/media/import location

The problem solved when I used following csv format :

"sku","base_image"
"WT09-XS-Purple","wt09-white_back-test.jpg"

and Images File Directory value as pub/media/import enter image description here

Issue on Github : https://github.com/magento/magento2/issues/2666

5

Not sure if this has anything to do with your issue as this is an internal import but:

In M2 I have images stored in pub/media/import but would get the same error

  1. Imported resource (image) could not be downloaded from external resource due to timeout or access permissions in row(s): 1, 2

I removed the path name from my CSV file and just have the image path as image.jpg with no slashes and it works great now.

  • I think this is specific to your case. Your images are directory in the directory not in a sub directory. – Stevie G Feb 28 '17 at 14:26
2

i am now working on Magento 2.2.6 / 7
and i faced the same error because directory path mechanism of different operating systems.

lets assume if images are in pub/media/import folder than we should mention the path like that :
1. in Windows (mostly for localhost/development purpose)- /pub/media/import
2. in Ubuntu (mostly for production server)- pub/media/import

here the one extra slash is causing the problem.

1

If you imported with external image url you can see my hotfix.

I found the problem come from the duplicate path for image after download from external url image.

I also created a pull request for it.

  • That worked for me. Could not import images from external urls anymore in 2.2.7. – Johnny Longneck Mar 19 at 18:55
0

Image path can be or cannot be without / that isn't problem. I've imported with both and it worked. In my case issue was the images given in path wasn't available in folder. I tried it with importing available and not-available image and was getting error in case when that image wasn't available. Path can be any one ,it isn't must to use pub/media/import only.

0

For the import images issue i have fixed the issue from Uploader.php file. change below file path code and success working import images.

File path: magento/vendor/magento/module-catalog-import-export/Model/Import/Uploader.php

Find the below line from line number 201:

$filePath = $this->_directory->getRelativePath($filePath . $fileName);

Replace with:

$filePath = strpos($filePath, $fileName) !== false ? $filePath:$this->_directory->getRelativePath($filePath . $fileName);

For More information Refer github link:

https://github.com/magento/magento2/pull/20761/commits/8612789375b0c173f0ba852c587882af6ff8bc7f

0

Just fixed the same issue by setting the owner of the images in pub/media/import to the web user.

In var/log/exception.log I found the following

[2019-06-05 21:02:06] main.CRITICAL: File 'pub/media/import/xxxx.jpg' was not found or has read restriction. {"exception":"[object] (Magento\\Framework\\Exception\\LocalizedException(code: 0): File 'pub/media/import/xxxx.jpg' was not found or has read restriction. at /opt/bitnami/apps/magento/htdocs/vendor/magento/module-catalog-import-export/Model/Import/Uploader.php:209)"} []

Under a Bitnami install the files were uploaded via FTP as the user 'bitnami' but in this install the webuser is 'daemon'

I ran the following to fix all ownerships on a Bitnami install and now it imports the images. Dont run this if your web user is not daemon.

sudo chown -R daemon:daemon /opt/bitnami/apps/magento/htdocs && sudo find . -type d -exec chmod 770 {} \; && sudo find . -type f -exec chmod 660 {} \; && sudo chmod u+x bin/magento-cli``

Although this solution is for a BItnami install it might help find your issue.

0

I just ran into this issue myself, and the fix had nothing to do with format of my csv or the file location of the images.

What was causing it for me was the permissions on the pub/media/import folder. It seems the images are placed here when being downloaded from an external source. When the system could not create the files here it threw back the mentioned issue.

To fix it all I had to do was run the following command to fix it (from the pub/media folder):

sudo chmod 777 import

Once I did this my products imported without error.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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