0

I'm trying the following:

https://jsfiddle.net/zgaxy70t/1/

However it looks like the settings aren't being honored. How can I configure max file size, max # files, and file types within my call to unsigned_cloudinary_upload?

$('.upload_field').unsigned_cloudinary_upload(preset_name, {
  cloud_name: 'cloudname',
                disableImageResize: false,
                imageMaxWidth: 2000,                           // 800 is an example value
                imageMaxHeight: 2000,                          // 600 is an example value
                maxFileSize: 8000000,                        // 20MB is an example value
                //loadImageMaxFileSize: 200000,               // default is 10MB
                acceptFileTypes: /(\.|\/)(gif|jpe?g|png|bmp|ico)$/i
}, {
  multiple: true
})

I also tried this:

//{
            //    cloud_name: 'test',
            //    max_files: settings.maxFiles,
            //    tags: tags,
            //    client_allowed_formats: ["png", "gif", "jpeg", "jpg", "jpe", "jpc", "jp2", "j2k", "wdp", "jxr", "hdp", "webp", "bmp", "tif", "tiff", "ico", "ps", "ept", "eps", "eps3", "psd", "svg", "ai", "djvu", "flif", "tga"],
            //    max_file_size: 8000000
            //},
BLAZORLOVER
  • 1,971
  • 2
  • 17
  • 27

1 Answers1

0

Currently, it's not possible to use the unsigned_cloudinary_upload method and limiting client allowed formats, max files, max file size.

A close workaround will be to use the cloudinary_fileupload method to have the upload unsigned. This will allow you to set the max file size, and use a regular expression to limit the file type.

An example for using maxFileSize , and acceptFileTypes would look like the below:

$('.cloudinary-fileupload').cloudinary_fileupload({maxFileSize:100000000,acceptFileTypes: /(.|\/)(gif|jpe?g|png|bmp|ico)$/i});
Richard-Degenne
  • 2,892
  • 2
  • 26
  • 43
Ido Bar Noam
  • 102
  • 4