Auto upload worked first time... then never again - any suggestions?
Hello, all and thanks in advance for any suggestions!
I have been trying to get the auto upload feature to work.
Following the documentation instructions it worked perfectly the first time loading an image from my wordpress site (https://popularhistorybooks.files.wordpress.com/) using some local html to set up a dummy website. However I have not been able to replicate this success after the first time despite a couple of hours of trying
- many combinations of different Upload settings :-(
- different image sources eg an airtable image link :-(
- escaping and also double escaping punctuation type characters in the URL :-(
- different media library folder targets for the upload, eg existing and not existing folders :-(
- different images on the same wordpress site, then the previously successful image in a different folder, and the same folder! :-(
I am using the url instructions carefully as per:
https://res.cloudinary.com/<Cloudinary account name>/<asset_type>/upload/<mapped upload folder prefix>/<partial path of remote file>
And the image shows up in the browser correctly (so it is somewhere in the Cloudinary ecosystem) it is just not uploading to my media library. It seems to be behaving like a fetch url not the upload url specified.
The bit that is confusing me most is why it would have worked for the first test image, but then not again - makes me think that I am overlooking something v simple so would be great to hear any suggestion about things to try.
Thanks!
-----
Some more info:
- Image link: https://popularhistorybooks.files.wordpress.com/2021/12/mosaic_of_justinianus_i_-_basilica_san_vitale_ravenna-4-edited.jpg?w=600
- auto upload mapping folder: test
- auto upload mapping url: https://popularhistorybooks.files.wordpress.com/
- src='https://res.cloudinary.com/**mycloudinaryname**/image/upload/test/2021/12/mosaic_of_justinianus_i_-_basilica_san_vitale_ravenna-4-edited.jpg?w=600'
- (btw this is the only image I tried that has the funny ?w=600 at the end (and it worked the first time - but not subsequent attempts))
-
So here is the solution, which I am putting up here in case others find it helpful - couldn't find anything else on this in my trawlings so had to work it out via trial and error:
- If you set (settings / upload options) "Auto-create folders:" to "True" first time, auto UPLOAD works as expected. It seems very forgiving of peculiar URL / file characters.
- If you set "Auto-create folders" to "False" - and the folder doesn't exist - upload URL is treated as FETCH, ie you get the image but it is only cached on the cloudinary CDN, not stored in your media library. My expectation (hope?) was that setting this to false would flatten the folder structure so you don't inherit annoying long folder trees. Looks like it is not possible to flatten the folder structure with auto upload.
- (this is the kicker) if you first set "Auto-create folders" to "False", and the folder doesn't exist, and you fail in your upload THEN you set "Auto-create folders" to "True" you will still fail in your upload as the image will exist in the CDN via the implicit earlier OPTION > FETCH command (see first bullet) and so Cloudinary will just pull the image without uploading it*. This is what got me as I thought Cloudinary would reset itself when you change the auto-create folders option - but it doesn't.
* You also need to be mindful of what your browser is caching too of course
My key take-away is that if you are using the auto-upload via URL feature always have "Auto-create folders:" set to "True".
Deal with the resultant Cloudinary folder mess later / ignore it / or better try and to change your upload URL to avoid the issue in the first place.
Hopefully that saves someone a few hours of frustration! If I have said anything inaccurate in the above please do comment :-)
0 -
Hi Anthony,
When setting the "Auto-create folders" to "False", the asset is uploaded, but the folder structure is not created.
for example:test/1/2/giraffe
, the asset won't show in the root and the folders won't be created but the asset will exist in our DB, it will be delivered and it could be searchable from the Media Library search.I know that it might be confusing.
It is always preferred to set Auto-create folders" to "True"(Default).
I will ask our documentation team to add a comment in the documentation about this behavior.
Thanks,
Wissam
0 -
Thanks Wissam, for your very clear summary
0
Post is closed for comments.
Comments
3 comments