Extension renamed while uploading .zip files.
So I've been trying to upload zip files to Cloudinary. Every time I upload a ZIP file the file extension gets renamed to .tmp.
I'm using PHP and below is my code
Example URL after uploading: https://res.cloudinary.com/mycloud/raw/upload/v1000000/myfolder/ls6wevjrm8coa8tw5020.tmp
-
Hi,
If the public_id is being chosen by us automatically and the result when uploading a raw file is that the public_id ends with 'tmp', that means that the filename that was sent to us in the upload API call has '.tmp' as the extension, i.e that $_FILES["myfile"]["tmp_name"] ends with .tmp
The two solutions are to send us the file's original / actual name with the upload call, or to set the public_id value explicitly in the API call, like this:
\Cloudinary\Uploader::upload(
$_FILES["myfile"]["tmp_name"],
array("folder" => "myfolder/",
"public_id" => "example.zip"
"resource_type" => "raw"));May I ask you to please one of those options and let me know if they solve the problem for you?
Regards,
Stephen -
Specifying the public_id explicitly in the call dosen't seem to help:
\Cloudinary\Uploader::upload(
$_FILES["myfile"]["tmp_name"],
array("folder" => "myfolder/",
"public_id" => "example.zip"
"resource_type" => "raw"));
Example URL after uploading:
https://res.cloudinary.com/mycloud/raw/upload/v1000000/myfolder/example.zip.tmp -
Hi,
Are you sure that the code was updated correctly?
On our side, I do not see any public_id parameter provided for that upload.
I see the file name was phpF493.tmp and the 'folder' parameter was pj-tr45az3SosRBJ6oK9jew but I do not see any value provided for public_id, so the public_id was set automatically and as before it ends with the extension of the file that you uploaded to us - the public_id was pj-tr45az3SosRBJ6oK9jew/ls6wevjrm8coa8tw5020.tmp
If you'd prefer to contact us directly and provide the exact API calls and responses you're making and receiving, there's a "Submit a Request" link on our support site where you can contact our team directly: https://support.cloudinary.com/hc/en-us
Regards,
Stephen
-
Thanks for the updated example - I've checked that on our backend and we're still taking the extension of the file that you uploaded in the HTTP request. I expected that manually specifying the public_id value including a file extension would override the value you provided as the filename, but I was incorrect, and we do use the details in the filename first.
Apologies for any confusion I caused there - typically the answer for that is to change the uploading code to send the correct filename, but versions of our PHP SDK after Version 1.14.0 have a 'filename' parameter on the upload method for that exact purpose, and it override what was sent in the multipart form data
May I ask you to try that and see if it works for you?
i.e something like this:
\Cloudinary\Uploader::upload($_FILES["myfile"]["tmp_name"],array("folder" => "myfolder/","filename" => $_FILES["myfile"]["name"],"resource_type" => "raw"));
Regards,Stephen
-
Hi,
Thanks for sharing the URL, that helps.
Please refer to the below article for information on why the URL fails -
https://support.cloudinary.com/hc/en-us/articles/360016480179-Why-does-my-pdf-link-isn-t-working-
As the article mentions, please open a support ticket with the details described in the article and we'll gladly help you solve this issue.
Thanks,
Roee
Post is closed for comments.
Comments
13 comments