PHP code example of qktong / think-cloudfile

1. Go to this page and download the library: Download qktong/think-cloudfile 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/ */

    

qktong / think-cloudfile example snippets


//上传文件
use qktong\cloudfile\FileService;
$fileService = new FileService();
$user_id    = '8';
$file_name  = 'test':
$extension  = 'jpg';
$mime       = 'image/jpeg';
$bucket     = 'test';
$streamData = file_get_contents('php://input');
$key        = $fileService->upload($user_id, $extension, $file_name, $mime, $streamData, $bucket);

//上传文件
use qktong\cloudfile\FileService;
$keys = 'test.jpg';
$fileService = new FileService();
$result      = $fileService->getFileUrl($keys,'');