PHP code example of ttiantianle / upload

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

    

ttiantianle / upload example snippets


单图:
<?= $form->field($model, 'avatar')->hiddenInput(['maxlength' => true,'id'=>'avatar']) 

  $('#$uploadInputId').fileinput({
        language: 'zh',
        uploadUrl: '?r=file/upload-file&type=$type&path=$path&size=$size',//换成自己的上传图片接口,可参照ttiantianle/upload/src/FileController.php
        deleteUrl: '?r=file/del-file',
        overwriteInitial: false,
        allowedFileTypes: [$type],
        initialPreviewAsData: true,
        initialPreviewShowDelete:true,
        maxFileCount:$maxFileCount,
        initialPreview:$initialPreview,
        initialPreviewConfig:$initialPreviewConfig,
    })});