PHP code example of job520 / uploader

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

    

job520 / uploader example snippets



// 1. 引入包
间
use job520\uploader;
// 3. 获取文件
$file = $_POST['file'];
// 4. 实例化上传类
$imageupload = new uploader($file);
// 5. 使用缩略图
$imageupload -> thumb = array(
    'is_thumb' => 1,
    'width' => 150,
    'height' => 150
);
// 6. 保存到file文件夹
$ret = $imageupload->save('files');
// 7. 打印输出
var_dump($ret);