Auto Upload not working -- not sure if it has to do with the image URL I am trying to upload
So I am trying to use the auto upload feature and with it the mapping so that I know the public ID when a user uploads to my site.
Here is the auto upload URL I am trying to use :
https://res.cloudinary.com/<cloud name>/image/upload/tys/2798dbc4-cb95-42a9-8bb3-52fa24ff70e2/-/resize/300x/
The full URL of the image I am trying to upload:
https://ucarecdn.com/2798dbc4-cb95-42a9-8bb3-52fa24ff70e2/-/resize/300x/
And here is my mapping in settings:
Folder: tys
URL Prefix: https://ucarecdn.com/
I get a 400 error with
-
Hi Kyle,
Looking at the logs for your account I can see why you're receiving an error. The reason is that the source URL requires the last forward slash for the request to work. For example,
https://ucarecdn.com/2798dbc4-cb95-42a9-8bb3-52fa24ff70e2/-/resize/300x/ - Works
https://ucarecdn.com/2798dbc4-cb95-42a9-8bb3-52fa24ff70e2/-/resize/300x - Throws an error
Now, the Cloudinary auto-upload URL you're using to access the image:
https://res.cloudinary.com/<cloud name>/image/upload/tys/2798dbc4-cb95-42a9-8bb3-52fa24ff70e2/-/resize/300x/
has the trailing slash as per the source URL, however, our system expects the image name to be the last part of the URL and it isn't expecting it to end without anything following the slash so it throws an error.
After looking into this further it seems the source URLs allow you to specify any string after the ..300x/ so what I've gone ahead and done is added a placeholder image name "test-image.jpg" to the end of the source URL - https://ucarecdn.com/2798dbc4-cb95-42a9-8bb3-52fa24ff70e2/-/resize/300x/test-image.jpg this would then allow me to use the auto-upload mapping and accessing this image via https://res.cloudinary.com/dhvgjssfm/image/upload/tys/2798dbc4-cb95-42a9-8bb3-52fa24ff70e2/-/resize/300x/test-image.jpg which retrieves the images from the remote URL as expected.
If you're not able to add these to the source URLs directly you can use this approach when auto-uploading the resources.
Best regards,
Aleksandar
0 -
Thank you so much this worked perfectly
0
Post is closed for comments.
Comments
2 comments