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

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

zwj68/upload
============

The file upload extension for the Flarum forum with insane intelligence.

01PHP

Since Dec 22Pushed 1y agoCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

Upload by FriendsOfFlarum
=========================

[](#upload-by-friendsofflarum)

[![MIT license](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://github.com/FriendsOfFlarum/upload/blob/master/LICENSE.md) [![Latest Stable Version](https://camo.githubusercontent.com/61961df5d2d6c20d6cd2c86bed60800f19ad10fb1949755304e581410e413d88/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f666f662f75706c6f61642e737667)](https://packagist.org/packages/fof/upload) [![Total Downloads](https://camo.githubusercontent.com/feb366ed3de14ecb3dff8a616f121fa4650da5eee4759b3ee341948a2afa5883/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f666f662f75706c6f61642e737667)](https://packagist.org/packages/fof/upload) [![OpenCollective](https://camo.githubusercontent.com/1903c197bb0307e60d6328653532b8a6b9890b898fbc92e314ab39d699491e74/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6f70656e636f6c6c6563746976652d666f662d626c75652e737667)](https://opencollective.com/fof/donate)

An extension that handles file uploads intelligently for your forum.

Features
--------

[](#features)

- For images:
    - Auto watermarks.
    - Auto resizing.
- Mime type to upload adapter mapping.
- Whitelisting mime types.
- Uploading on different storage services (local, imgur, AWS S3 for instance).
- Drag and drop uploads.
- Uploading multiple files at once (button and drag and drop both support this).
- Easily extendable, the extension heavily relies on Events.
- Extender interface to disable or force particular adapters (see below)

Installation
------------

[](#installation)

Install manually:

```
composer require fof/upload:"*"
```

Updating
--------

[](#updating)

```
composer require fof/upload:"*"
php flarum migrate
php flarum cache:clear
```

Configuration
-------------

[](#configuration)

Enable the extension, a new tab will appear on the left hand side. This separate settings page allows you to further configure the extension.

Make sure you configure the upload permission on the permissions page as well.

### Mimetype regular expression

[](#mimetype-regular-expression)

Regular expressions allow you a lot of freedom, but they are also very difficult to understand. Here are some pointers, but feel free to ask for help on the official Flarum forums.

In case you want to allow all regular file types including video, music, compressed files and images, use this:

```
(video\/(3gpp|mp4|mpeg|quicktime|webm))|(audio\/(aiff|midi|mpeg|mp4))|(image\/(gif|jpeg|png))|(application\/(x-(7z|rar|zip)-compressed|zip|arj|x-(bzip2|gzip|lha|stuffit|tar)|pdf))

```

A mimetype consists of a primary and secondary type. The primary type can be `image`, `video` and `application` for instance. The secondary is like a more detailed specification, eg `png`, `pdf` etc. These two are divided by a `/`, in regex you have to escape this character by using: `\/`.

### Disable or Force a particular adapter

[](#disable-or-force-a-particular-adapter)

In some circumstances, you may wish to either disable an adapter, or force the use of one. This is set in your root `extend.php` file.

For example, you may disable `imgur`

```
(new FoF\Upload\Extend\Adapters())
        ->disable('imgur'),

```

Chaining of multiple commands is also possible:

```
(new FoF\Upload\Extend\Adapters())
        ->disable('imgur')
        ->disable('aws-s3'),

```

You may also force an adapter:

```
(new FoF\Upload\Extend\Adapters())
        ->force('imgur'),

```

Adapter names currently available:

- `local`
- `imgur`
- `qiniu`
- `aws-s3`

Commands
--------

[](#commands)

### MapFilesCommand

[](#mapfilescommand)

Using `php flarum fof:upload` you have a powerful tool in your hands to map uploads to posts and clean up unused files. To do so there are two steps to take into consideration:

- Mapping (`--map`) allows you to look through posts to identify whether which uploaded files have been used inside any posts, and store this information
- Clean up (`--cleanup`, `--cleanup-before=yyyy-mm-dd`) grants you to ability to remove files that have been uploaded before the given time and haven't been mapped to any (existing) posts.

The intent of this command stems from the original concept of understand what uploads are used where and to allow removal of unused, stale files. You can run this command manually or as a cronjob.

Example 1; only mapping files:

```
php flarum fof:upload --map
```

Example 2; map and clean up

```
php flarum fof:upload --map --cleanup --cleanup-before="a month ago"
```

Once you're happy with how the command operates, you can append the flag `--force`, which removes the need to confirm the action:

```
php flarum fof:upload --map --cleanup --cleanup-before="last year" --force
```

The following (to resume) will happen when this command is put into a recurring cronjob:

- based on the interval of the cronjob (daily, weekly or however)
- the command will go over all uploads to discover in which posts they have been used
- delete those files that have been uploaded "last year" that have not been found in posts

FAQ
---

[](#faq)

- **AWS S3**: read the [AWS S3 configuration page](https://github.com/FriendsOfFlarum/upload/wiki/aws-s3).
- **Adding Templates**: read the [Custom Templates wiki page](https://github.com/FriendsOfFlarum/upload/wiki/Custom-Templates).
- **Upgrading from flagrow/upload**: read the [wiki article](https://github.com/FriendsOfFlarum/upload/wiki/Upgrade-from-Flagrow-Upload).

Links
-----

[](#links)

- [![OpenCollective](https://camo.githubusercontent.com/8ea53c451470d1a72789d650c77e2b22eee915f7fbf2cbeeeeaa25f47301efe2/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d667269656e64736f66666c6172756d2d3434414545353f7374796c653d666f722d7468652d6261646765266c6f676f3d6f70656e2d636f6c6c656374697665)](https://opencollective.com/fof/donate)
- [Flarum Discuss post](https://discuss.flarum.org/d/4154)
- [Source code on GitHub](https://github.com/FriendsOfFlarum/upload)
- [Report an issue](https://github.com/FriendsOfFlarum/upload/issues)
- [Download via Packagist](https://packagist.org/packages/fof/upload)

An extension by [FriendsOfFlarum](https://github.com/FriendsOfFlarum)

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity16

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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/b428a670a9c853928c6b9e98ecb176eabcaea6bf1f810684ff3f75011dd3deb3?d=identicon)[zwj68](/maintainers/zwj68)

---

Top Contributors

[![luceos](https://avatars.githubusercontent.com/u/504687?v=4)](https://github.com/luceos "luceos (187 commits)")[![imorland](https://avatars.githubusercontent.com/u/16573496?v=4)](https://github.com/imorland "imorland (79 commits)")[![flarum-bot](https://avatars.githubusercontent.com/u/39334649?v=4)](https://github.com/flarum-bot "flarum-bot (52 commits)")[![clarkwinkelmann](https://avatars.githubusercontent.com/u/5264300?v=4)](https://github.com/clarkwinkelmann "clarkwinkelmann (34 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (14 commits)")[![davwheat](https://avatars.githubusercontent.com/u/7406822?v=4)](https://github.com/davwheat "davwheat (13 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (10 commits)")[![rylat](https://avatars.githubusercontent.com/u/6824779?v=4)](https://github.com/rylat "rylat (7 commits)")[![DavideIadeluca](https://avatars.githubusercontent.com/u/146922689?v=4)](https://github.com/DavideIadeluca "DavideIadeluca (6 commits)")[![SychO9](https://avatars.githubusercontent.com/u/20267363?v=4)](https://github.com/SychO9 "SychO9 (5 commits)")[![askvortsov1](https://avatars.githubusercontent.com/u/38059171?v=4)](https://github.com/askvortsov1 "askvortsov1 (3 commits)")[![ImakuTranslate](https://avatars.githubusercontent.com/u/25817039?v=4)](https://github.com/ImakuTranslate "ImakuTranslate (3 commits)")[![rafaucau](https://avatars.githubusercontent.com/u/25438601?v=4)](https://github.com/rafaucau "rafaucau (3 commits)")[![zwj68](https://avatars.githubusercontent.com/u/21981041?v=4)](https://github.com/zwj68 "zwj68 (3 commits)")[![Hiobi](https://avatars.githubusercontent.com/u/2171856?v=4)](https://github.com/Hiobi "Hiobi (2 commits)")[![KonstantinCodes](https://avatars.githubusercontent.com/u/844484?v=4)](https://github.com/KonstantinCodes "KonstantinCodes (2 commits)")[![theFlob](https://avatars.githubusercontent.com/u/9917848?v=4)](https://github.com/theFlob "theFlob (2 commits)")[![tony199555](https://avatars.githubusercontent.com/u/11675398?v=4)](https://github.com/tony199555 "tony199555 (2 commits)")[![KyrneDev](https://avatars.githubusercontent.com/u/13856015?v=4)](https://github.com/KyrneDev "KyrneDev (2 commits)")[![skmedix](https://avatars.githubusercontent.com/u/3246162?v=4)](https://github.com/skmedix "skmedix (2 commits)")

### Embed Badge

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

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

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

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

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15161.6M2.6k](/packages/illuminate-filesystem)[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)[madnest/madzipper

Easier zip file handling for Laravel applications.

1382.3M6](/packages/madnest-madzipper)

PHPackages © 2026

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