PHPackages                             oh86/laravel-uploadfile - 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. oh86/laravel-uploadfile

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

oh86/laravel-uploadfile
=======================

upload/download/view file with laravel framework

v1.1(1y ago)0137MITPHPPHP ^7.4 || ^8.0

Since Mar 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/OneHundred86/laravel-uploadfile)[ Packagist](https://packagist.org/packages/oh86/laravel-uploadfile)[ RSS](/packages/oh86-laravel-uploadfile/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (3)Versions (3)Used By (0)

### 基于laravel框架实现的文件上传/下载/查看功能

[](#基于laravel框架实现的文件上传下载查看功能)

#### 1.安装

[](#1安装)

```
composer require oh86/laravel-uploadfile
php artisan vendor:publish --provider="Oh86\UploadFile\UploadFileServiceProvider"

php artisan migrate
```

#### 2.配置`config/uploadfile.php`

[](#2配置configuploadfilephp)

```
return [
    // 允许上传的文件类型（真正文件类型）
    'allow_exts' => [
        'jpg',
        'png',
        'mp4',
        'mov',
        'pdf',
        'doc',
        'docx',
        'xls',
        'xlsx',
    ],

    // 加密机
    'encryptor' => env('UPLOADFILE_ENCRYPTOR', 'local'),

    // 配置查看文件路由路径
    'app_url' => env('UPLOADFILE_APP_URL', env('APP_URL')),
    'view_file_uri' => 'file/view',
    'tmp_view_file_uri' => 'file/tmp/view',

    // 按业务需求暴露路由路径
    'routes' => [
        [
            'method' => 'post',
            'uri' => 'file/upload',
            'action' => [\Oh86\UploadFile\Controllers\FileController::class, 'upload'],
            'middlewares' => [],
        ],
        [
            'method' => 'get',
            'uri' => 'file/tmp/view',
            'action' => [\Oh86\UploadFile\Controllers\FileController::class, 'tmpView'],
            'middlewares' => [],
        ],
        [
            'method' => 'get',
            'uri' => 'file/download',
            'action' => [\Oh86\UploadFile\Controllers\FileController::class, 'download'],
            'middlewares' => [],
        ]
    ],
];
```

#### 3.文件常见操作

[](#3文件常见操作)

```
use Oh86\UploadFile\Models\File;

// 上传本地文件
$file = File::upload(new \SplFileInfo('/xxx/target_file.txt'));

// 获取查看url
$url = $file->genTmpViewFileUrl();
$url = $file->genViewFileUrl();

// 标记关联资源
$file->setAssocInfo(\App\Models\Post::class, 1);

// 判断文件类型
$file->isImage();
$file->isVideo();
$file->idPdf();
$file->isWord();
$file->isExcel();
```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance45

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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

Every ~56 days

Total

2

Last Release

424d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c3f893211000acbd1a600e2159a778865e4f7e54661239721c9fb5c240d7626b?d=identicon)[oh86](/maintainers/oh86)

---

Top Contributors

[![OneHundred86](https://avatars.githubusercontent.com/u/22148561?v=4)](https://github.com/OneHundred86 "OneHundred86 (11 commits)")

### Embed Badge

![Health badge](/badges/oh86-laravel-uploadfile/health.svg)

```
[![Health](https://phpackages.com/badges/oh86-laravel-uploadfile/health.svg)](https://phpackages.com/packages/oh86-laravel-uploadfile)
```

###  Alternatives

[rahulhaque/laravel-filepond

Use FilePond the Laravel way

264127.9k2](/packages/rahulhaque-laravel-filepond)[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135212.4k7](/packages/statamic-rad-pack-runway)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21313.7k3](/packages/ecotone-laravel)[slimani/filament-media-manager

A media manager plugin for Filament.

115.1k](/packages/slimani-filament-media-manager)

PHPackages © 2026

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