upload file size limit [ok]

This commit is contained in:
life
2014-11-09 18:00:23 +08:00
parent 2a457d6027
commit 346abfe91d
14 changed files with 165 additions and 16 deletions

View File

@ -83,10 +83,11 @@ define('attachment_upload', ['jquery.ui.widget', 'fileupload'], function(){
// 检查文件大小
var size = data.files[0].size;
if(typeof size == 'number' && size > 1024 * 1024 * 5) {
var maxFileSize = +GlobalConfigs["uploadAttachSize"] || 100;
if(typeof size == 'number' && size > 1024 * 1024 * maxFileSize) {
tpl.find("img").remove();
tpl.removeClass("alert-info").addClass("alert-danger");
tpl.append(" Warning: File size is bigger than 5M");
tpl.append(" Warning: File size is bigger than " + maxFileSize + "M");
setTimeout((function(tpl) {
return function() {
tpl.remove();
@ -156,10 +157,11 @@ define('attachment_upload', ['jquery.ui.widget', 'fileupload'], function(){
// 检查文件大小
var size = data.files[0].size;
if(typeof size == 'number' && size > 1024 * 1024) {
var maxFileSize = +GlobalConfigs["uploadAvatarSize"] || 100;
if(typeof size == 'number' && size > 1024 * 1024 * maxFileSize) {
tpl.find("img").remove();
tpl.removeClass("alert-info").addClass("alert-danger");
tpl.append(" Warning: File size is bigger than 1M");
tpl.append(" Warning: File size is bigger than " + maxFileSize + "M");
setTimeout((function(tpl) {
return function() {
tpl.remove();