PHP code example of catlane / chunk-file-upload

1. Go to this page and download the library: Download catlane/chunk-file-upload 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/ */

    

catlane / chunk-file-upload example snippets



    'disks' => [
    
            'local' => [
                'driver' => 'local' ,
                'root' => storage_path ( 'app' ) ,
            ] ,
    
            'public' => [
                'driver' => 'local' ,
                'root' => storage_path ( 'app/public' ) ,
            ] ,
            'qiniu_live' => [//七牛云
                'driver' => 'qiniu' ,//如果是七牛云空间,必填qiniu
                'domains' => [
                    'default' => '****' , //你的七牛域名
                    'https' => '' , //你的HTTPS域名
                    'custom'    => '****',                //你的自定义域名
                ] ,
                'access_key' => '****' ,  //AccessKey
                'secret_key' => '*****' ,  //SecretKey
                'bucket' => '***' ,  //Bucket名字
                'url' => '*******' ,  // 填写文件访问根url
            ]
        ] ,
        'default' => [
            'disk' => 'public' ,//默认磁盘
            'extensions' => 'jpg,png,mp4' ,//后缀
            'mimeTypes' => 'image/*,video/*' ,//类型
            'fileSizeLimit' => 10737418240 ,//上传文件限制总大小,默认10G,默认单位为b
            'fileNumLimit' => '5' ,//文件上传总数量
            'saveType' => 'json', //单文件默认为字符串,多文件上传存储格式,json:['a.jpg','b.jpg']
        ]

$ composer isan vendor:publish --tag=chunk-file-upload

$ php artisan storage:link


Encore\Admin\Form::extend('chunk_file', \Encore\ChunkFileUpload\ChunkFileField::class);

$form->chunk_file('file', '视频');

$grid->picture ( '图片' )->display(function ($picture) {
    return json_decode($picture, true);
})->image ('http://test.com:81/storage/', 300);