mirror of https://gitee.com/karson/fastadmin.git
优化分片上传配置开关和分片大小
parent
1d37f23a5e
commit
926e16bde6
|
|
@ -65,7 +65,7 @@
|
||||||
<!-- 账号信息下拉框 -->
|
<!-- 账号信息下拉框 -->
|
||||||
<li class="dropdown user user-menu">
|
<li class="dropdown user user-menu">
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||||
<img src="{$admin.avatar|cdnurl|htmlentities}" class="user-image" alt="{$admin.nickname|htmlentities}">
|
<img src="{$admin.avatar|cdnurl|htmlentities}" class="user-image" alt="">
|
||||||
<span class="hidden-xs">{$admin.nickname|htmlentities}</span>
|
<span class="hidden-xs">{$admin.nickname|htmlentities}</span>
|
||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
|
|
@ -112,4 +112,4 @@
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</nav>
|
</nav>
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,6 @@
|
||||||
<label for="c-third" class="control-label col-xs-12 col-sm-2"></label>
|
<label for="c-third" class="control-label col-xs-12 col-sm-2"></label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<button type="button" id="faupload-third" class="btn btn-danger faupload" data-multiple="true" data-input-id="c-third" ><i class="fa fa-upload"></i> {:__("Upload to third")}</button>
|
<button type="button" id="faupload-third" class="btn btn-danger faupload" data-multiple="true" data-input-id="c-third" ><i class="fa fa-upload"></i> {:__("Upload to third")}</button>
|
||||||
{if config('upload.chunking')}
|
|
||||||
<button type="button" id="faupload-third-chunk" class="btn btn-danger faupload" data-chunking="true" data-multiple="true" data-input-id="c-third" ><i class="fa fa-upload"></i> {:__("Upload to third by chunk")}</button>
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
@ -29,9 +26,6 @@
|
||||||
<label for="c-local" class="control-label col-xs-12 col-sm-2"></label>
|
<label for="c-local" class="control-label col-xs-12 col-sm-2"></label>
|
||||||
<div class="col-xs-12 col-sm-8">
|
<div class="col-xs-12 col-sm-8">
|
||||||
<button type="button" id="faupload-local" class="btn btn-primary faupload" data-input-id="c-local" data-url="{:url('ajax/upload')}"><i class="fa fa-upload"></i> {:__("Upload to local")}</button>
|
<button type="button" id="faupload-local" class="btn btn-primary faupload" data-input-id="c-local" data-url="{:url('ajax/upload')}"><i class="fa fa-upload"></i> {:__("Upload to local")}</button>
|
||||||
{if config('upload.chunking')}
|
|
||||||
<button type="button" id="faupload-local-chunking" class="btn btn-primary faupload" data-chunking="true" data-input-id="c-local" data-url="{:url('ajax/upload')}"><i class="fa fa-upload"></i> {:__("Upload to local by chunk")}</button>
|
|
||||||
{/if}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -174,6 +174,14 @@ class Upload
|
||||||
var_dump($array);
|
var_dump($array);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 合并分片文件
|
||||||
|
* @param string $chunkid
|
||||||
|
* @param int $chunkcount
|
||||||
|
* @param string $filename
|
||||||
|
* @return attachment|\think\Model
|
||||||
|
* @throws UploadException
|
||||||
|
*/
|
||||||
public function merge($chunkid, $chunkcount, $filename)
|
public function merge($chunkid, $chunkcount, $filename)
|
||||||
{
|
{
|
||||||
$filePath = $this->chunkDir . DS . $chunkid;
|
$filePath = $this->chunkDir . DS . $chunkid;
|
||||||
|
|
|
||||||
|
|
@ -171,6 +171,8 @@ class Config extends Model
|
||||||
'bucket' => 'local',
|
'bucket' => 'local',
|
||||||
'maxsize' => $uploadcfg['maxsize'],
|
'maxsize' => $uploadcfg['maxsize'],
|
||||||
'mimetype' => $uploadcfg['mimetype'],
|
'mimetype' => $uploadcfg['mimetype'],
|
||||||
|
'chunking' => $uploadcfg['chunking'],
|
||||||
|
'chunksize' => $uploadcfg['chunksize'],
|
||||||
'multipart' => [],
|
'multipart' => [],
|
||||||
'multiple' => $uploadcfg['multiple'],
|
'multiple' => $uploadcfg['multiple'],
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -30,4 +30,8 @@ return [
|
||||||
* 是否支持分片上传
|
* 是否支持分片上传
|
||||||
*/
|
*/
|
||||||
'chunking' => false,
|
'chunking' => false,
|
||||||
|
/**
|
||||||
|
* 默认分片大小
|
||||||
|
*/
|
||||||
|
'chunksize' => 2097152,
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -141,6 +141,9 @@ define(['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined,
|
||||||
//上传URL
|
//上传URL
|
||||||
url = url ? url : Config.upload.uploadurl;
|
url = url ? url : Config.upload.uploadurl;
|
||||||
url = Fast.api.fixurl(url);
|
url = Fast.api.fixurl(url);
|
||||||
|
var chunking = Config.upload.chunking || false,
|
||||||
|
chunkSize = Config.upload.chunksize || 2097152;
|
||||||
|
|
||||||
//最大可上传文件大小
|
//最大可上传文件大小
|
||||||
maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload.maxsize;
|
maxsize = typeof maxsize !== "undefined" ? maxsize : Config.upload.maxsize;
|
||||||
//文件类型
|
//文件类型
|
||||||
|
|
@ -190,6 +193,8 @@ define(['jquery', 'bootstrap', 'dropzone', 'template'], function ($, undefined,
|
||||||
}
|
}
|
||||||
return params;
|
return params;
|
||||||
},
|
},
|
||||||
|
chunking: chunking,
|
||||||
|
chunkSize: chunkSize,
|
||||||
maxFilesize: maxFilesize,
|
maxFilesize: maxFilesize,
|
||||||
acceptedFiles: mimetype,
|
acceptedFiles: mimetype,
|
||||||
maxFiles: (maxcount && parseInt(maxcount) > 1 ? maxcount : (multiple ? null : 1)),
|
maxFiles: (maxcount && parseInt(maxcount) > 1 ? maxcount : (multiple ? null : 1)),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue