zhuayi / upload
此包已被废弃,不再维护。未建议替代包。
基于laravel的文件上传扩展,目前支持七牛云存储
1.1.4
2016-04-20 06:57 UTC
Requires
- php: >=5.5.9
- qiniu/php-sdk: 7.0.5
Requires (Dev)
- phpmd/phpmd: @stable
This package is not auto-updated.
Last update: 2018-04-10 17:21:11 UTC
README
安装
新项目安装
####为了安装Laravel 5 Zhuayi,只需将以下内容添加到您的composer.json中。
"zhuayi/upload": "@stable"
然后运行composer install或composer update。
然后在您的config/app.php中添加
Zhuayi\admin\UploadServiceProvider::class
运行发布
php artisan vendor:publish --force
修改 config/upload.php
return [ 'default' => 'local', 'local' => [ 'path' => public_path() . '/uploads', 'url' => '/uploads', ], 'qiniu' => [ 'accessKey' => accessKey, 'secretKey' => secretKey, 'bucket' => bucket, 'path' => path, 'url' => url, ] ];
##使用from上传文件
$reset = Zhuayi\upload\upload::file('Filedata'); if (is_null($reset->error)) { return $reset->url; } else { return $reset->error; }
##使用本地文件上传到七牛
$reset = upload::uploadToQiniu(path, newName); if (is_null($reset->error)) { return $reset->url; } else { return $reset->error; }