代码拉取完成,页面将自动刷新
结合 Webuploader
切片上传文件功能实现,网站在处理大文件上传缓慢,或者不能上传的功能。
>=5.5
composer require auroralzdf/big-file-upload
php artisan vendor:publish --provider='AuroraLZDF\Bigfile\BigfileServiceProvider'
执行完 php artisan vendor:publish --provider='AuroraLZDF\Bigfile\BigfileServiceProvider'
,会在 config
下面生成 bigfile.php
配置文件。配置项说明:
<?php
return [
/*
|------------------------
| 文件每次切片尺寸
|------------------------
*/
'chunk_size' => 1024 * 1024 * 2,
/*
|------------------------
| 允许上传文件最大尺寸
|------------------------
*/
'max_size' => 1024 * 1024 * 1024,
/*
|------------------------
| 文件保存路径
|------------------------
*/
'save_path' => 'upload/' . date('Y') . '/' . date('m') . '/',
/*
|------------------------
| 文件切片缓存路径
|------------------------
*/
'tmp_path' => storage_path('app/public/tmp'),
/*
|------------------------
| 允许上传文件类型
|------------------------
*/
'allow_type' => ['jpg', 'jpeg', 'gif', 'png', 'mp4', 'mp3', 'zip', 'apk', 'pdf', 'rar'],
/*
|------------------------
| 切片文件是否随机命名
|------------------------
*/
'rand_name' => true,
/*
|------------------------
| 是否删除临时文件
|------------------------
*/
'remove_tmp_file' => true,
];
Route::middleware('web')->get('/upload/bigfile', '\AuroraLZDF\Bigfile\Controllers\BigfileController@loadView')->name('bigfile_view');
// bindings:不限制API访问次数限制,不需要 csrf_token 验证
Route::middleware('bindings')->post('/upload/bigfile', '\AuroraLZDF\Bigfile\Controllers\BigfileController@upload')->name('bigfile_upload');
...
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型