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

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

itxiao6/upload
==============

minkenrel upload

151134PHP

Since Nov 24Pushed 8y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

基于PHP编写的一个文件存储包:支持LAMP\\LNMP\\MAMP\\SWOOLE
==========================================

[](#基于php编写的一个文件存储包支持lamplnmpmampswoole)

### 介绍:上传文件驱动支持:阿里云OSS，阿里云OSS，七牛云OSS 支持普通文件上传和base64文件上传

[](#介绍上传文件驱动支持阿里云oss阿里云oss七牛云oss-支持普通文件上传和base64文件上传)

#### 1. 引入入口

[](#1-引入入口)

```
use Itxiao6\Upload\Upload;
```

#### 2. 设置文件存储驱动(支持本地存储,七牛云oss,阿里云OSS)

[](#2-设置文件存储驱动支持本地存储七牛云oss阿里云oss)

```
Upload::set_driver('Local');// Local\Qiniu\Alioss
```

#### 3. 启动驱动

[](#3-启动驱动)

```
# 本地文件存储器
    # 定义上传的文件夹
    $directory = __DIR__.'/';

    # 定义上传完的webUrl
    $webUrl = '/';

    # 启动上传组件
    Upload::start($directory,$webUrl);

# 七牛云存储器
    # 定义accessKey
    $accessKey = 'hmkss38pl8WJZjPpbbgY5Ldzj9Ma0_RsCUPezt';
    # 定义secretKey
    $secretKey = '0R2ossqsaaEqmaOZSkwHl5aSXYD4hDQxKAUQIpdvPSvt';
    # 定义桶的名字
    $Bucket_Name = 'upload';

    # 定义外网访问路径
    $host = 'http://ovy5w745h.bkt.clouddn.com/';

    # 启动上传组件
    Upload::start($accessKey,$secretKey,$Bucket_Name,$host);
    # 获取七牛云的上传token
    $token = Upload::get_token();
# 阿里云OSS存储器
    Upload::set_driver('Alioss');
    // 桶的名字
    $bucket_name = 'testupload';
    # 您选定的OSS数据中心访问域名 参考(https://help.aliyun.com/document_detail/31837.html?spm=5176.doc32100.2.4.QQpTvt)
    $data_host = 'oss-cn-hongkong.aliyuncs.com';
    # 阿里云的secretKey
    $accessKey = 'LTAIGYU9s407aZ';
    # 阿里云的secretKey
    $secretKey = 'UcKYzskkrRqsdW7eWs0wf3a';

    Upload::start($accessKey,$secretKey,$bucket_name,$data_host);
```

#### 4. 上传文件

[](#4-上传文件)

```
# 单个文件
$data = Upload::upload('picname');
# 多个文件
$data = Upload::uploads('picname');
```

#### 5. 上传 base64 文件

[](#5-上传-base64-文件)

```
# 单个文件
$data = Upload::upload_base64($_POST['file']);
# 多个文件
$data = Upload::uploads_base64($_POST['file']);
```

#### 6. 处理结果

[](#6-处理结果)

```
# 判断是否上传成功
if($data!=false){
    # 输出图片
    echo "";
}else{
    # 输出错误信息
    echo Upload::get_error_message('picname');
}
```

*附录1.拓展*1.存储器:必须使用\\Itxiao6\\Upload\\Interfaces\\Storage接口 a.设置驱动

```
Session::set_interface('MyName',MyClass::class);
```

b.使用驱动,只需在上文第二步替换参数即可

```
Upload::set_driver('MyName');
```

c.设置参数,启动存储器

```
# 启动上传组件
Upload::start('参数');// 这个参数会在存储器的create方法接收到，create指向的是 存储器的构造方法。
```

2.验证规则:必须使用Itxiao6\\Upload\\Interfaces\\Validation接口 a.在上文第4步，上传文件时直接传入即可

```
$data = Upload::upload('picname',[new MyValidation()]);
```

b.错误信息和上文的获取方法一样

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4aa333e293f1a1ac60afd39e0c6f3463404df4d6e2ff11bff698c868826aab18?d=identicon)[itxiao6](/maintainers/itxiao6)

---

Top Contributors

[![itxiao6](https://avatars.githubusercontent.com/u/20547806?v=4)](https://github.com/itxiao6 "itxiao6 (38 commits)")

### Embed Badge

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

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

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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