zhuayi / upload
基于laravel的file上传扩展,目前支持七牛云存储
Installs: 5 367
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 2
Forks: 4
Open Issues: 0
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
Installation
New Project installation
####In order to install Laravel 5 Zhuayi, just add
"zhuayi/upload": "@stable"
to your composer.json. Then run composer install or composer update.
Then in your config/app.php add
Zhuayi\admin\UploadServiceProvider::class
Run Publish
php artisan vendor:publish --force
modify config/upload.php
return [ 'default' => 'local', 'local' => [ 'path' => public_path() . '/uploads', 'url' => '/uploads', ], 'qiniu' => [ 'accessKey' => accessKey, 'secretKey' => secretKey, 'bucket' => bucket, 'path' => path, 'url' => url, ] ];
##Usage upload file with from
$reset = Zhuayi\upload\upload::file('Filedata'); if (is_null($reset->error)) { return $reset->url; } else { return $reset->error; }
##Usage upload local file to qiniu
$reset = upload::uploadToQiniu(path, newName); if (is_null($reset->error)) { return $reset->url; } else { return $reset->error; }