add option of max size of uploaded file

This commit is contained in:
printempw 2016-10-16 20:18:40 +08:00
parent 7f0e9a4178
commit 86d82931bb
6 changed files with 23 additions and 6 deletions

View File

@ -242,7 +242,7 @@ class SkinlibController extends Controller
{
$this->validate($request, [
'name' => 'required|no_special_chars',
'file' => 'required|max:10240',
'file' => 'required|max:'.option('max_upload_file_size'),
'public' => 'required'
]);

View File

@ -3,7 +3,7 @@
* @Author: printempw
* @Date: 2016-07-29 11:53:11
* @Last Modified by: printempw
* @Last Modified time: 2016-09-25 13:31:41
* @Last Modified time: 2016-10-16 20:09:27
*/
return [
@ -35,5 +35,6 @@ return [
'copyright_text' => '<strong>Copyright &copy; 2016 <a href="{site_url}">{site_name}</a>.</strong> All rights reserved.',
'auto_del_invalid_texture' => '0',
'return_200_when_notfound' => '0',
'cache_expire_time' => '31536000'
'cache_expire_time' => '31536000',
'max_upload_file_size' => '1024'
];

View File

@ -2,7 +2,7 @@
* @Author: printempw
* @Date: 2016-07-19 10:46:38
* @Last Modified by: printempw
* @Last Modified time: 2016-10-04 13:40:10
* @Last Modified time: 2016-10-16 20:16:45
*/
'use strict';
@ -236,12 +236,12 @@ function upload() {
type: 'warning',
html: json.msg
}).then(function() {
$('#upload-button').html(trans('skinlib.confirmUpload')).prop('disabled', '');
$('#upload-button').html(trans('skinlib.upload')).prop('disabled', '');
});
}
},
error: function(json) {
$('#upload-button').html(trans('skinlib.confirmUpload')).prop('disabled', '');
$('#upload-button').html(trans('skinlib.upload')).prop('disabled', '');
showAjaxError(json);
}
});

View File

@ -89,4 +89,7 @@ custom:
# of "email". This simply helps us make messages a little cleaner.
#
attributes:
file: File
name: Name
player_name: 'Player Name'
identification: Email or player name

View File

@ -80,6 +80,7 @@ custom:
attributes:
name: 名称
file: 文件
username: 用户名
identification: 邮箱或角色名
nickname: 昵称

View File

@ -95,6 +95,18 @@
</td>
</tr>
<tr>
<td class="key">最大允许上传大小
<i class="fa fa-question-circle" title="PHP 限制:<?php echo ini_get('post_max_size'); ?>,定义在 php.ini 中。" data-toggle="tooltip" data-placement="top"></i>
</td>
<td class="value">
<div class="input-group">
<input type="text" class="form-control" name="max_upload_file_size" value="{{ option('max_upload_file_size') }}">
<span class="input-group-addon">KB</span>
</div>
</td>
</tr>
<tr>
<td class="key">角色名</td>
<td class="value">