Skip to main content

Editing an existing resource in Cloudinary

Comments

5 comments

  • Raya Straus

    Hi Ray,

    The folder name should be passed in as well as its part of the public id. For more guidelines, please see the following- https://support.cloudinary.com/hc/en-us/articles/202520852-How-can-I-update-an-already-uploaded-image- 

     

    0
  • Ray Rozowski

    The Folder name seems to work the very first time. If I pass the Folder Name when re-uploading a brochure, it creates another sub-folder under the folder where the current brochure exists.

    0
  • Daniel Mendoza

    Hi Ray,

    It would be easier if we could see the values being passed in the first initial upload and on the reupload. I am particularly interested in the values passed for propertyBrochurePdf.Folder = _cloudinaryBrochureFolder and propertyBrochurePdf.PublicId = brochure.Cloudinary_PublicId. I believe that on the reupload, the original folder is being included again and thus causing the same folder structure to be within the folder. If you don't wish to share the details on this public forum, please open a support ticket at https://support.cloudinary.com/hc/en-us/requests/new and also include the `cloud_name` that the issue is happening on.

    0
  • Ray Rozowski

    Hi Daniel,

    You are right. Here is the flow:-

    First Upload:- Folder Name = "qa/Property/Brochure" and Public Id empty string. The Public Id returned is saved.

    Lets say the public id returned is "qa/property/brochures/abcdefghijk"

    Second Upload:- Folder Name = "qa/Property/Brochure" and Public Id returned from first call, i.e. "qa/property/brochures/abcdefghijk". 

    Actual result:- A file is created under the folder with path: qa/property/brochures/qa/property/brochures/abcdefghijk.pdf

    Expected result: I would expect the file to be at qa/property/brochures and not qa/property/brochures/qa/property/brochures.

    My question here is what the best way to re-upload a brochure. It seems like passing just the public id and not passing the folder for re-upload seems to overwrite which was the expected behavior.

     

     

    0
  • Daniel Mendoza

    Hi Ray,

    I am assuming that in your first upload, you wish to have the public_id be random. If this is the case, the upload logic could look like this:

    1. If public_id is empty, pass folder name and public id will stay an empty string
    2. else (public_id not empty), pass in only the public_id (e.g. qa/property/brochures/abcdefghijk)

    I believe this what you suggested at the end and seems like the best way to do it.

    Hope this helps.

    0

Post is closed for comments.