PHPackages                             cdyun/thinkphp-upload - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. cdyun/thinkphp-upload

ActiveLibrary[File &amp; Storage](/categories/file-storage)

cdyun/thinkphp-upload
=====================

TP plugin cdyun/thinkphp-upload

v1.0.4(5mo ago)0291MITPHPPHP ^8.1

Since Nov 9Pushed 5mo agoCompare

[ Source](https://github.com/cdyun303/thinkphp-upload)[ Packagist](https://packagist.org/packages/cdyun/thinkphp-upload)[ RSS](/packages/cdyun-thinkphp-upload/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (2)Versions (6)Used By (1)

Thinkphp Upload插件
=================

[](#thinkphp-upload插件)

### 安装

[](#安装)

```
composer require cdyun/thinkphp-upload

```

### 例子

[](#例子)

```
use Cdyun\ThinkphpUpload\UploadEnforcer;

$upload = new UploadEnforcer();
// 默认上传
$result = $upload->move(File文件);
// 指定上传路径
$result = $upload->path('uploads')->move(File文件);
// 指定文件名
$result = $upload->name('file.txt')->move(File文件);
// 自定义验证
$result = $upload->validate(['fileSize' => 1024])->move(File文件);
// 多个配置
$result = $upload->path('uploads')->validate(['fileSize' => 1024])->name('file.txt')->move(File文件);
```

##### path() - 支持设置路径；

[](#path---支持设置路径)

##### name() - 支持设置文件名；

[](#name---支持设置文件名)

##### validate() - 支持自定义验证，参考TP官方的上传验证；

[](#validate---支持自定义验证参考tp官方的上传验证)

##### move() - 文件上传，大文件支持分片；

[](#move---文件上传大文件支持分片)

##### steam() - 文件流上传；

[](#steam---文件流上传)

##### delete() - 文件删除；

[](#delete---文件删除)

##### sign() - 文件签名；

[](#sign---文件签名)

### 配置文件

[](#配置文件)

- （TP框架配置文件）config/filesystem.php

```
