According to the documentation, this is how you limit the type of file the user can upload:
This is how I implemented it in my code:
var myWidget = window.cloudinary.createUploadWidget(
{
cloudName: "456aefaefaefayrw",
uploadPreset: "dadazf",
sources: ["local"],
resourceType: "image",
},
(error, result) => {
if (!error && result && result.event === "success") {
console.log("Done! Here is the image info: ", result.info);
}
}
);
Cloudinary allows uploading pdf as image type and videos when passed as image
are uploaded as an image. You can use clientAllowedFormats
option in the upload widget and that will block any other format from uploading other than the one specified or you can mention that in the upload preset.