diff --git a/public/js/client/client.js b/public/js/client/client.js index 6805211..1835422 100644 --- a/public/js/client/client.js +++ b/public/js/client/client.js @@ -126,6 +126,14 @@ $(function(){ chunk_size: '4mb', // 分块上传时,每块的体积 auto_start: true, // 选择文件后自动上传,若关闭需要自己绑定事件触发上传 unique_names: true, + filters : { + max_file_size : '10mb', + prevent_duplicates: true, + // Specify what files to browse for + mime_types: [ + {title : "Image files", extensions : "jpg,gif,png,bmp"}, // 限定jpg,gif,png后缀上传 + ] + }, init: { 'FilesAdded': function(up, files) { plupload.each(files, function(file) { diff --git a/public/js/server/index.js b/public/js/server/index.js index f49360e..a2b8159 100644 --- a/public/js/server/index.js +++ b/public/js/server/index.js @@ -235,6 +235,14 @@ layui.use(['layer', 'form', 'jquery'], function () { chunk_size: '4mb', // 分块上传时,每块的体积 auto_start: true, // 选择文件后自动上传,若关闭需要自己绑定事件触发上传 unique_names: true, + filters : { + max_file_size : '10mb', + prevent_duplicates: true, + // Specify what files to browse for + mime_types: [ + {title : "Image files", extensions : "jpg,gif,png,bmp"}, // 限定jpg,gif,png后缀上传 + ] + }, init: { 'FilesAdded': function(up, files) { plupload.each(files, function(file) { diff --git a/routes/index.js b/routes/index.js index ccef424..72ebb54 100644 --- a/routes/index.js +++ b/routes/index.js @@ -27,7 +27,8 @@ router.get('/uptoken', function(req, res, next) { var mac = new qiniu.auth.digest.Mac(AppConfig.QINIU.accessKey, AppConfig.QINIU.secretKey); var options = { scope: 'kefu', - expires: 7200 + expires: 7200, + mimeLimit:"image/*" }; var putPolicy = new qiniu.rs.PutPolicy(options); var uploadToken=putPolicy.uploadToken(mac);