PHPackages                             xjw/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. xjw/upload

ActiveLibrary

xjw/upload
==========

upload files

v1.0.7(6y ago)09MITPHPPHP &gt;=5.3.0

Since Aug 29Pushed 6y ago1 watchersCompare

[ Source](https://github.com/xiajunwei0407/upload)[ Packagist](https://packagist.org/packages/xjw/upload)[ RSS](/packages/xjw-upload/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

### 文件上传类

[](#文件上传类)

#### 使用方法

[](#使用方法)

###### HTML部分的代码示例：

[](#html部分的代码示例)

```

```

###### php部分的代码示例：

[](#php部分的代码示例)

```
// 请使用异常捕获
try{
    // 配置说明
    $config = [
               'allowExt'       => ['mp3', 'mp4'], // 允许上传的文件类型;非必传,默认['*']
               'allowSize'      => '2M', // 允许上传的文件大小;非必传，默认2M；可选单位B,K,M,G
               'uploadRoot'     => '../resources/uploads/', // 文件上传的根目录；必传,末尾带/
               'savePath'       => 'path/to/xxx/', // 文件保存的子目录；必传,开头不带/,末尾带/
               'saveNameMode'   => 'random', // 文件名生成模式；非必传，默认random，可选值random--随机,original--源文件名,custom--自定义，需指定saveName
               'saveName'       => 'test.mp4', // 保存的文件名；saveNameMode=custom时必传，其他情况不用传
               'dayDir'         => true, // 是否按 /年月/日 的形式生成目录；非必传，默认true
               'isCover'        => false, // 是否覆盖同名文件；非必传，默认false，有同名文件时抛出异常
          ];
    $upload = new Xjw\Upload\Upload($config);
    $result = $upload->upload(); // 上传结果
    //var_dump($result);
    $r = $upload->getReturnData(); // 上传成功后返回的信息
    //var_dump($r);
}catch(Exception $e){
    var_dump($e->getMessage());
}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2451d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8e7ef28fe0c583269868e9759c84011c9a4761cdcd61facb1a47508171dde9b7?d=identicon)[xiajunwei](/maintainers/xiajunwei)

---

Top Contributors

[![xiajunwei0407](https://avatars.githubusercontent.com/u/30016382?v=4)](https://github.com/xiajunwei0407 "xiajunwei0407 (2 commits)")

### Embed Badge

![Health badge](/badges/xjw-upload/health.svg)

```
[![Health](https://phpackages.com/badges/xjw-upload/health.svg)](https://phpackages.com/packages/xjw-upload)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
