How to delete 'raw' resources?

Follow

Comments

6 comments

  • Avatar
    aditya

    Thanks for the response,
    I have to create a thumbnail for any resource uploaded on cloudinary(including "raw") is there a way to achieve it apart from using aspose ?

    0
    Comment actions Permalink
  • Avatar
    Rohit Kumar

    Suppose i want to delete this file
    res.cloudinary.com/dekmtxrqb/raw/upload/setixbbu9i03qnrczmbf.txt

    then what should be the exact payload for this ?

    \Cloudinary\Uploader::destroy('setixbbu9i03qnrczmbf.txt', array("resource_type" => "raw"));

    am right?

    0
    Comment actions Permalink
  • Avatar
    Maor Gariv

    Hi Rohit,

    Thanks for reaching out.

    Yes:) This is correct.
    The default `resource_type` is `image` so when destroying `video` or `raw` files, you should set the appropriate `resource_type`.

    0
    Comment actions Permalink
  • Avatar
    aditya

    How do I delete the resource which was created using a add-on ? like I have a used a add-on

    "aspose" to create a pdf on upload of a raw resource type. When I delete the raw resource type the pdf one resource should also get deleted. How do I achieve that ?
    0
    Comment actions Permalink
  • Avatar
    Loic Verger Del Bove

    Hi Aditya,

    When using the Aspose Add-On, it generates a PDF which has the `resource_type:image` whereas the file uploaded has the `resource_type:raw`, hence you can run a deletion with those 2 types like this: 

    To delete the raw file in Python:

    cloudinary.uploader.destroy('p5sxi8s04oiueembnt5k.xls', resource_type = 'raw')

    To delete the PDF created via Aspose in Python:

    cloudinary.uploader.destroy('p5sxi8s04oiueembnt5k.xls')

    Best,

    Loic

    0
    Comment actions Permalink
  • Avatar
    Loic Verger Del Bove

    Hi Aditya,

    Using Aspose is the only way to achieve the conversion from a `raw` file to a PDF with the `resource_type:image`. From there, you can then use transformations to generate the thumbnail.

    You can find all the information on how to do it in this article.

    Hope it helps.

    Best,

    Loic

    0
    Comment actions Permalink

Please sign in to leave a comment.