Download different resource types in one zip file
We are currently evaluating Cloudinary for a large project. Unfortunately we don’t seem to be able to download different resource types via the PHP SDK in one zip file. In our application users can decide to „shop“ for example six image files, twi videos and some other (raw) files.
They should then be able to download them directly in one zip file. Is this currently not possible? When we try the generate_archive methods on these mixed public ids, the API returns a rather misleading „missing public id(s)“ error message.
As this might be a major blocker for our project: Is this currently not possible? Is it planned? Is there a workaround?
Many thanks in advance
-
Official comment
Hi Dima,
Thanks for your message.
Yes, this is indeed supported, however, it's a relatively new addition so the documentation is still being worked on.
To do this, you can make use of what we call fully_qualified_public_ids. This is where as part of the generate_zip or archive method, you specify not only the public_ids but also the resource_type and type. Then you would set the resource_type parameter in the method call to "auto".
Below is an example in PHP.
$public_ids = [
"image/upload/image_example",
"video/upload/video_example",
"raw/upload/text_file.txt,
];
Uploader::create_zip(
array(
"resource_type" => "auto",
"fully_qualified_public_ids" => $public_ids
)
);Please try this out and let me know how it goes.
Best regards,
Aleksandar
-
Hi Aleksandar.
That works like a charm! Thank you very much :)
0 -
Hello Aleksandar,
I tried downloading different types of resources in a zip file with the download_zip_url method via the Python SDK, but found that resource_type = "auto" does not work.
I did the solution you posted, but it doesn't work. Is there currently a method to download zip urls with files from different types of resources?
Many thanks in advance.
0 -
Hi Anthony,
Can you please share the code you are using? Are you using the `fully_qualified_public_ids` parameter to define the list of public_ids? It won't work if you use `public_ids` but should work with the parameter above.
Thanks in advance.
Best,
Loic
0
Post is closed for comments.
Comments
4 comments