PHP code example of awheel / oss-upload

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

    

awheel / oss-upload example snippets



composer el\OSSUpload\OSSUpload;

$bucket = '__BUCKET_NAME__';
$accessKeyId = '__ACCESS_KEY_ID__';
$accessKeySecret = '__ACCESS_KEY_SECRET__';
$endpoint = '__ENDPOINT__';
$pathPrefix = '/testupload';

$upload = new OSSUpload($bucket, $accessKeyId, $accessKeySecret, $endpoint, $pathPrefix);
$md5 = $upload->upload('./test.png');
$path = $upload->upload('./test.png', true);

echo $md5.PHP_EOL;
echo $path.PHP_EOL;