ImageUploadParams also accept PDF ?
Hello All,
I am able to Upload PDF's using ImageUploadParams. Something like this:-
ImageUploadParams listingBrochurePdf = new ImageUploadParams();
if (string.IsNullOrEmpty(brochure.Cloudinary_PublicId) && string.IsNullOrEmpty(brochure.Cloudinary_Url))
{
listingBrochurePdf.Folder = _cloudinaryBrochureFolder;
}
if(!string.IsNullOrEmpty(brochure.Cloudinary_PublicId))
{
listingBrochurePdf.PublicId = brochure.Cloudinary_PublicId;
}
listingBrochurePdf.File = new FileDescription(brochure.FileName, new MemoryStream(brochure.Attachment));
listingBrochurePdf.UseFilename = true;
listingBrochurePdf.UniqueFilename = true;
ImageUploadResult result = _cloudinary.UploadResource(listingBrochurePdf);
brochure.ViewUrl = result.SecureUri.AbsoluteUri;
brochure.Cloudinary_PublicId = result.PublicId;
brochure.Cloudinary_Url = result.SecureUri.AbsoluteUri;
Is it okay to use ImageUploadParams to upload PDF's ? It seems like it is working perfectly. ImageUploadParams don't complain even when we upload PDF's.
However when we upload pptx it seems to complain with an error: Unsupported Zip Types.
Do ImageUploadParams have implicit support for PDF ? What all file formats does ImageUploadParams accept.
-
Hi Ray
PDF is supported to be uploaded and transformed as a resource type of type "image", which is why "ImageUploadParams" supported uploading it correctly.
You can see a full list of supported formats here
If you want to upload other formats which are not media formats (like the pptx file) you would need to upload these as raw files which require the "RawUploadParams" method.
0 -
Thanks @Ido Barnoam. In our application we upload images and PDF's only. So is it okay to continue to upload the PDF's via ImageUploadParams. We have not noticed any issues with it so far. We are able to download them as PDF's.
So do you think it is okay for us to continue to use PDF's via ImageUploadParams ?
0 -
Hi Ray,
If the current method works for you, then it's great and you can, of course, continue uploading the pdf as resource type "image" :)
Raw files can't be transformed. So uploading the pdf as resource type "image" would also allow to transform them as well.
0
Post is closed for comments.
Comments
3 comments