magento2: CSV Product Import - Images reporting failure.
Short:
Step1: Created a product by hand and exported it as csv file. Step2: Deleted the product, so the Database is empty again. Step3: Uploaded the images Step4: Imported the csv file
[base|small|thumbnail|swatch]_image are working. additional_images is empty and throwing this error:
Imported resource (image) could not be downloaded from external resource due to timeout or access permissions in rows: ...
Long:
I’ve created a product by hand and exported it as CSV. I used that CSV file as pattern and added all the products. I also uploaded the images in pub/media/import. I’ve put the first image as base_image small_image etc. and put every image again into the ‘additional_images’ column. When pressing import (with correct image path entered) it finds all the images and copies them to pub/media/catalog/product. However it reports the following:
Imported resource (image) could not be downloaded from external resource due to timeout or access permissions in rows: ...
Now comes the weird part: the base, small etc images are working. So the overview in frontend and backend are both having images. When editing the product, the gallery is empty. When entering the product detail-page, the images are missing.
When exporting the products again the base, small etc fields are correctly set, additional_images are empty. So something musts be broken with that field regarding the import feature.
I would fix it by myself but have no single clue where to start looking for that. So if anyone has a hint or maybe even a fix for this, i would be very thankful.
(Before anyone asks, got the same problem when importing the exported csv without adding further products)
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 58 (10 by maintainers)
I have fixed it by running the below on magento root directory …
Looks like the group or the user of apache/nginx does not have the permission to write on pub/media/catalog/product even if you don’t have it on pub it will not allow you to write.
find var vendor pub/static pub/media app/etc -type f -exec chmod g+w {} \;find var vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} \;@magento-team
if you can add a log along with return false in the below function resides in
will help the developers to easily identify the issue.
OK the solution to this problem is so stupid simple that anyone reading this and spending more than 1 hr will be kicking themselves. Problem: When importing images from a remote server get error “Imported resource (image) could not be downloaded from external resource due to timeout or access permissions in rows: …”
Solution: Make sure that the folder you are importing the images exists currently, and if not you must create it manually via ftp or cpanel.
If you are importing files from your same server, import it as “example.png” vs “pub/media/import/example.png” if you are using “pub/media/import” as your uploading directory.
This is one solution for this error, so there may be multiple reasons this error is showing, that being said this solution worked for me … Again, the error should be updated to be more specific I agree GL to all, hope this helps
As yet, I have seen no way to resolve this issue. Based on how long is been open 12 months and counting, its obviously not a priority to magento devs to resolve.
so by summarising all the solutions I’ve seen here and in other places, I did the following:
'Image-Name.jpg' > md5('Image-Name') . 'jpg'chown www-data:www-data pub/media/import/*chmod 0755 pub/media/import/*.jpgas a result - everything worked
PS if you following then do not forget to change image filenames to
md5('Image-Name') . 'jpg'in your csv fileHaving same problem. Any update?
this idea not worked for me
I was getting the same error, i fixed this. The solution was to have no spacial charechter, no space in the image file names. only alphabets and numbers. And it worked for me.
We had the exact same problem as explained here, but for us this had nothing to do with permissions or incorrect filepaths.
Using the suggestion from @senthilengg by logging the exception in the ‘uploadMediaFiles’ function, we came to the conclusion that our client had uploaded corrupt .jpg files.
In Magento\Framework\Image\Adapter\AbstractAdapter an exception was thrown in the ‘validateUploadFile’ function which caused the import to fail.
I think this issue can be closed as it is not Magento who is causing this issue. The actual problems are caused by manual actions (ie. setting incorrect permissions, using faulty images, etc. …). However, I do agree that logging and output are lacking quite a bit. Users could more easily spot their problems if the output was more accurate and closer to the actual problem.
Hi,
So Im experiencing an issue with relation to the above.
Now, I do not believe this to be an error with regards to permissions as I have been able to upload 1000’s of images using the same import file structure no issues.
I have attached a sample file with 3 rows. Row 1 is fine and imports Row 2 has a mixture of good images and images from a website that file. Row 3 has images from a site that always fails.
Further to this I went into a product record and tried to use the remote url as the path and this worked… I used the urls from the failed lines.
Example Steps: Here I go into any product and use the same url that failed via the import routine.
This saved successfully
Also see attached sample file. Please note sample file uses the “^” as the field delimeter.
batch_10_1_github_issue.txt
What do I think it is??
Perhaps a timeout setting with curl? Or whatever is used to control the fetching of images from remote sites. I think this setting is perhaps too low and thus times out too early to complete the download.
I did a quick hunt around and can see curl is used and can see the following: curlopt_connecttimeout
but it uses settings from getConfig Which I cannot find where these are located
Regards Brendan
Not sure if this has anything to do with your issue as this is an internal import but I realized the CVS files should have no file path for the images. It should just be the image name.
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.
+1 Same issue here. Tried manually specifying a path like
var/import_mediatried specifyingpub/media/importand leaving it blank. Any ideas?