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

前端 未结 15 906
深忆病人
深忆病人 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:04

    .fileupload({
        add: function (e, data) { 
            var attachmentValue = 3 * 1000 * 1024;
            var totalNoOfFiles = data.originalFiles.length;
            for (i = 0; i < data.originalFiles.length; i++) {
                if (data.originalFiles[i]['size'] > attachmentValue) {
                    $attachmentsList.find('.uploading').remove();
                    $attachmentMessage.append("
  • " + 'Uploaded bytes exceeded the file size' + "
  • "); $attachmentMessage.show().fadeOut(10000, function () { $attachmentMessage.html(''); }); data.originalFiles.splice(i, 1); } } if (data.files[0]) { $attachmentsList .prepend('
  • ' + data.files[0].name + '
  • '); } data.submit(); }

提交回复
热议问题