Skip to main content

Auto upload worked first time... then never again - any suggestions?



  • Anthony

    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 :-) 

  • Wissam Khalili

    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.






  • Anthony

    Thanks Wissam, for your very clear summary


Post is closed for comments.