PHP code example of alpha1130 / open-admin-qcs-upload

1. Go to this page and download the library: Download alpha1130/open-admin-qcs-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/ */

    

alpha1130 / open-admin-qcs-upload example snippets


$config = [
    'secretId' => env('QCLOUD_COS_SECRET_ID', ''),
    'secretKey' => env('QCLOUD_COS_SECRET_KEY', ''),
    'bucket' => env('QCLOUD_COS_BUCKET', ''),
    'region' => env('QCLOUD_COS_REGION', 'ap-guangzhou'),
    'durationSeconds' => 6000,
    'publishDomain' => '',
    'allowPrefix' => ['*'],
    'keyPrefix' => '',
];

$form->qcsupload('field-name')
    ->addVariables(['config' => $config])
    ->attribute('style', 'width: 100px; height: 100px;')
    ->attribute('accept', 'image/png, image/jpeg, image/jpg')
    ->help(sprintf('Size: 80 x 80, Format: png, jpg, jpeg'));