Renaming a raw asset using the image rename method?
I am uploading raw files using the method described here:
http://support.cloudinary.com/entries/26445481-Can-I-upload-large-raw-non-images-files-
Once they are uploaded, I'd like to rename them. The only trouble is, the public ID for raw files, such as 'nokqjs93kpgphtvielqh.sql' results in the resource not being found with this error:
Fatal error: Uncaught exception 'Cloudinary\Error' with message 'Resource not found - files/nokqjs93kpgphtvielqh.sql'
If I try and rename a regular image with its public ID,** it works without issue**. I know that the raw resource is there, its in my Media Library. Is renaming raw assets somehow different than the method for renaming images?
-
In default, API calls are set to the
image
resource type. In order to perform API calls forraw
resources, you should also set theresource_type
toraw
in therename
API call.
For example in PHP:\Cloudinary\Uploader::rename('old_name', 'new_name', array("resource_type" => "raw"));
Also note that the public ID can be set while uploading, by setting the
public_id
parameter to your required public ID instead of the randomly generated one.
For example:\Cloudinary\Uploader::upload("file.sql" array("public_id" => "my_file.sql", "resource_type" => "raw"));
For more information in PHP:
http://cloudinary.com/documentation/php_image_upload#public_id0 -
This completely solves my issue! Thank you!
0
Post is closed for comments.
Comments
2 comments