Downloads
Stars
Version
方便的多网关上传组件,目前支持阿里云OSS,以后支持腾讯云等多平台上传处理。
开发作者:向军大叔
使用 composer 安装软件包
composer require houdunwang/uploader
组件会自动发布配置文件 uploader.php
到项目的 config
目录中,需要先进行相应配置。
也可以使用以下方式手动发布配置:
$ laravel php artisan vendor:publish
Which provider or tag's files would you like to publish?:
[0 ] Publish files from all providers and tags listed below
[1 ] Provider: BeyondCode\DumpServer\DumpServerServiceProvider
[2 ] Provider: Fideloper\Proxy\TrustedProxyServiceProvider
[3 ] Provider: Illuminate\Mail\MailServiceProvider
[4 ] Provider: Illuminate\Notifications\NotificationServiceProvider
[5 ] Provider: Illuminate\Pagination\PaginationServiceProvider
[6 ] Provider: Laravel\Tinker\TinkerServiceProvider
[7 ] Tag: config
[8 ] Tag: laravel-mail
[9 ] Tag: laravel-notifications
[10] Tag: laravel-pagination
> 7
Publishing complete.
设置 config/uploader.php
文件中的上传配置项。
访问控制
中添加一个新帐号accessKeyId
与 accessKeySecret
资料设置到配置文件中oss
使用权限。oss
服务中新增 bucket
块bucket
块配置跨域访问权限公共读
外网访问
配置项中的 EndPoint
设置到配置文件中的 endpoint
项下面以阿里云上传为例介绍使用方法。
使用Facade
调用
Route::get('/', function () {
return Uploader::config(config('uploader'))->upload('index.php');
});
使用 provider
服务调用
Route::get('/', function () {
return app(\Houdunwang\Uploader\Uploader::class)->config(config('uploader'))->upload('index.php');
});