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,
Stephen0 -
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.tmp0 -
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
0 -
Hey,
Yes the code was updated correctly.
\Cloudinary\Uploader::upload($_FILES["myFile"]["tmp_name"],array("folder" => "pj-tr45az3SosRBJ6oK9jew/","public_id" => "example.zip","resource_type" => "raw"));I did retry again, below is a screenshot attached for your reference.
0 -
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
0 -
THANKS A TON STEPHEN!!!
Works absolutely fine. Thank you for the support :)
0 -
You're welcome; sorry again about my earlier mistake, and I'm glad it's working for you now
0 -
That's totally fine Stephen no worries.
I'm not sure what's wrong here but then when i try to access the uploaded file it gives me a 404 error. Could you please assist me on that?
0 -
Hi!
Can you please share the Cloudinary URL that is failing?0 -
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,
Roee0 -
Hey,
I've raised a support ticket regarding the same.
Thank You0 -
Hey,
I couldn't find your ticket.
Can you please send it again?
Best,
0
Post is closed for comments.
Comments
13 comments