dev-master
9999999-devupload file for PHP laravel
MIT
The Requires
- php >= 5.4
- jdavidbakr/replaceable-model ^1.0
upload file upload img
upload file for PHP laravel
composer require wubuze/upload-file, (*1)
app\config\app.php 文件中provider 加上, laravel5.5 以上可以忽略, (*2)
Wubuze\UploadFile\UfffServiceProvider::class,, (*3)
php artisan vendor:publish , 选择 wubuze-file-config, (*4)
生成的storage.php 文件里面可以配置文件上传路径, (*5)
php artisan storage:link, (*6)
php artisan migrate 生成表 file、file_group, (*7)
创建 App\Model\File 必须继承 UploadFile\Model\File\File, (*8)
$module = config('storage.'.$req->input('module')); if (!$module) { return 'error'; }, (*9)
Uploader::init($req->file('file'));, (*10)
$file->setUrl();, (*11)
return @[ 'id' => $file->id, 'url' => $file->url, 'top' => $file->top, 'name' => $file->file.'.'.$file->type, ];, (*12)
upload file for PHP laravel
MIT
upload file upload img