Error trying to upload CSV (Validation failed: xxx.jpg is not a valid image file type.)

Solved
thuffam
Tourist
4 1 2

Hi 

I am getting the following error when trying to upload a csv file.

Line 2-4: Validation failed: /trio-of-hearts-1.jpg is not a valid image file type.

The csv line is as follows:

trio-of-hearts,Trio of hearts,Unique acrylic drop earrings.  Handmade Australian jewelery with surgical steel (surgical-grade stainless steel) hooks.,,,,,,,,,,,,,,,,,,,,,,https://candytree.s3-ap-southeast-2.amazonaws.com/trio-of-hearts-1.jpg,,Trio of hearts,,,,,,,,,,,,,,,,,,,,,active

The image files are hosted on AWS S3 eg https://candytree.s3-ap-southeast-2.amazonaws.com/trio-of-hearts-1.jpg

The images are valid jpg files and are publicly available.

Could someone please tell me what the actual reason is - as the error message from Shopify is incorrect (the file is definitely a valid image file type) 

Kind Regards

Tim 

0 Likes
Peter
Shopify Staff
Shopify Staff
2203 216 461

@thuffam 

There are a few culprits that could cause this error: 

________

Culprit 1: 

Some self-hosting solutions allow for public-facing images but protect the links on the server using different levels of 3rd party permissions. This would be known as Read Only permissions.

The CSV requires READ & WRITE permissions to be available on the folder in your file server that houses the images. Once the CSV has finished importing the images, the original folder Read-Only permissions can be re-instated.

Culprit 2: 

Commonly, merchants will try to use a private or invalid URL to instruct Shopify about what images it should grab for their products. It's important to remember that it needs to be a DIRECT link to a PUBLIC image. In other words, the URL should end in the file name (ie. alekmackie.com/images/myproduct.jpg), and visiting that URL in your browser should bring you to a page with JUST that image, and no other content.

Culprit 3: 

The file server is denying our request. It could see multiple attempts to download the image as "bot" activity, or simply is rejecting our request to download the image. 

________

Your error is likely connected to Culprit 1 or 3 as it does not appear to be connected to number 2. In any case, our support would be limited as we can't control how the image server you're using reacts to our request. If you're still having trouble uploading the images after checking the permission, then you may want to touch base with Amazon or use a different image hosting software. 

Peter | Social Care @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes
thuffam
Tourist
4 1 2

This is an accepted solution.

Thanks for your reply.

After some investigation it turns out the issue was caused by an incorrect content type assigned to the images (on S3) by the python library I was using to upload the images to S3 - boto3 which defaults to Content-Type: binary/octet-stream.  I have now coded it to use image/jpeg and it to work.

For those doing the same, the addition parameters to the upload_file function are:

        s3.upload_file(local_file, bucket, s3_fileExtraArgs={'ContentType': 'image/jpeg'}

 

I would also like to clarify - that the CSV import process does not require write access to image files - public, read-only access is all that is required.  

Thanks again

Tim