14 Star 49 Fork 4

aurora / webupoloader-bigFile

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Laravel Bigfile Upload

说明

结合 Webuploader 切片上传文件功能实现,网站在处理大文件上传缓慢,或者不能上传的功能。

Laravel版本

>=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');

...

MIT License Copyright (c) 2019 aurora Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

结合 Webuploader 切片上传文件功能实现,网站在处理大文件上传缓慢,或者不能上传的功能。 展开 收起
PHP 等 4 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/auroraLZDF/webupoloader-bigFile.git
git@gitee.com:auroraLZDF/webupoloader-bigFile.git
auroraLZDF
webupoloader-bigFile
webupoloader-bigFile
master

搜索帮助