管理后台游戏编辑上传图片限制大小

master
zhengyongxing 5 years ago
parent f009243399
commit dce35b6ff1

@ -200,6 +200,14 @@ class FileController extends AdminController
/* 调用文件上传组件上传文件 */
$Picture = D('Picture');
$pic_driver = C('PICTURE_UPLOAD_DRIVER');
if (I('icon')) {
if ($_FILES['file']['size'] > 51200) {
$return = array('status' => 1001, 'info' => '图片大小不得超过50k', 'data' => '');
$this->ajaxReturn($return);
}
}
$info = $Picture->upload(
$_FILES,
C('PICTURE_UPLOAD'),

@ -251,7 +251,7 @@
</div>
</div>
</span>
<span class="notice-text">尺寸不得小于512*512px圆角半径113px不强制要求可直接提供512*512方图</span>
<span class="notice-text">尺寸不得小于125*125px大小不得超过50K</span>
</td>
</tr>
<tr class="picbox">
@ -1678,7 +1678,8 @@
}
</script>
<script>
<script>
var iconInfo = {userId:"kazaff", md5:"",icon:1}; //用户会话信息
var uploaderImgIcon = WebUploader.create({
// 选完文件后,是否自动上传。
auto: true,
@ -1707,7 +1708,7 @@
thumb:true,
compress:false,
prepareNextFile: true,
formData: function(){return $.extend(true, {}, userInfo);},
formData: function(){return $.extend(true, {}, iconInfo);},
chunked:false,
duplicate: true
});
@ -1789,23 +1790,29 @@
imgListIconData.push(Number(response.id));
setIconVal();
console.log(response)
$( '#'+file.id ).find('p.state').text('已上传').fadeOut(800);
//alert(JSON.stringify(response));
$('#'+file.id).find('h4.info').append('<a href="javascript:;" class="jsdelzip table_click" style="float:none;display:inline-block;margin-left:10px;">删除</a>');
$('#'+file.id).find('.jsdelzip').on('click',function() {
uploaderImgIcon.removeFile( file.id );
$('#'+file.id).remove();
if (response.status==1001) {
alert('图片大小不得超过50k');
$('#icon_thelist').children().last().remove();
} else {
$( '#'+file.id ).find('p.state').text('已上传').fadeOut(800);
//alert(JSON.stringify(response));
$('#'+file.id).find('h4.info').append('<a href="javascript:;" class="jsdelzip table_click" style="float:none;display:inline-block;margin-left:10px;">删除</a>');
$('#'+file.id).find('.jsdelzip').on('click',function() {
uploaderImgIcon.removeFile( file.id );
$('#'+file.id).remove();
$.each(imgListIconData,function(index, item) {
if (response.id == item) {
imgListIconData.splice(index,1);
return false;
}
});
setIconVal();
$.each(imgListIconData,function(index, item) {
if (response.id == item) {
imgListIconData.splice(index,1);
return false;
}
return false;
});
setIconVal();
}
return false;
});
});
function setIconVal()

Loading…
Cancel
Save