PHP code example of liucg1995 / laravel-uploader

1. Go to this page and download the library: Download liucg1995/laravel-uploader library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

liucg1995 / laravel-uploader example snippets


Liucg1995\Uploader\UploaderServiceProvider::class,

[
    'disk'=>'public',
]

      {!! form_upload_attach('file','file',$item) !!}
    

     {!! form_upload_attaches('file','file','id') !!}
   

    Model::create(['file'=>$request->file , 'file_id'=>$request->file_id]);
    

     UploadMulti::save_multi_info($request->file, $news->id, 'news');
    

'disks' => [
    'bos' => [
        'driver'       => 'bos',
        'access_key_id'    =>  'xxxxxxxxxx',
        'access_key_secret'   => 'xxxxxxxxxx',
        'bucket'       => 'xxx',
        'region'    =>  'gz'    //改成存储桶相应地域
    ],
]

'cos' => [
        'driver'       => 'cos',
        'app_id'    =>  '123456789',
        'secret_id'   => 'xxxxxxxxxxx',
        'secret_key'   => 'xxxxxxxxxxx',
        'bucket'       => 'xxxxxxxxx',
        'region'    =>  'sh'    //改成存储桶相应地域
    ]

'oss' => [
        'driver'       => 'oss',
        'access_key'   => 'xxxxxxxxxx',
        'secret_key'   => 'xxxxxxxxxx',
        'bucket'       => 'xxxxx',
    ],

composer 

'qiniu' => [
        'driver'     => 'qiniu',
        'access_key' => 'xxxxxxxxxxxxxxxxxx',
        'secret_key' => 'xxxxxxxxxxxxxxxxxx',
        'bucket'     => 'xxxxxxxxxxxxxxxxxx',
        'domain'     => 'xxxxxxxxxxx'
    ],

composer 

[
    'disk'=>'qiniu',
]
sh
php artisan vendor:publish --provider=Liucg1995\\LaravelUploader\\UploadServiceProvider
php artusan migrate