maxFileSize and acceptFileTypes in blueimp file upload plugin do not work. Why?

前端 未结 15 905
深忆病人
深忆病人 2020-12-07 08:34

I\'m using Blueimp jQuery file upload plugin for upload files.

I had no problem in uploading but the option maxFileSize and acceptFileTypes

15条回答
  •  無奈伤痛
    2020-12-07 09:09

    You could also use an extra function like:

        function checkFileType(filename, typeRegEx) {
            if (filename.length < 4 || typeRegEx.length < 1) return false;
            var filenameParts = filename.split('.');
            if (filenameParts.length < 2) return false;
            var fileExtension = filenameParts[filenameParts.length - 1];
            return typeRegEx.test('.' + fileExtension);
        }
    

提交回复
热议问题