PHP code example of chziyun / think6-oss

1. Go to this page and download the library: Download chziyun/think6-oss 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/ */

    

chziyun / think6-oss example snippets


use chziyun\Filesystem;

$file = $this->request->file('file');
$filesystem = new Filesystem($file);
// 上传到默认磁盘
$fileName = $filesystem->upload();
// 指定上传位置并保存到数据库
$fileName = $filesystem->setDisk('qiniu')->addFilesystem('image')->upload();
echo $fileName;