PHPackages                             nepada/file-upload-control - 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. nepada/file-upload-control

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

nepada/file-upload-control
==========================

File upload control for Nette forms: multi-file AJAX upload via blueimp-file-upload, Bootstrap 4 and 5 template.

v1.9.2(5mo ago)84.8k↓11.1%1[3 PRs](https://github.com/nepada/file-upload-control/pulls)BSD-3-ClausePHPPHP &gt;=8.1.0 &lt;8.6CI failing

Since Apr 25Pushed 2mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (21)Versions (20)Used By (0)

File Upload form control
========================

[](#file-upload-form-control)

[![Build Status](https://github.com/nepada/file-upload-control/workflows/CI/badge.svg)](https://github.com/nepada/file-upload-control/actions?query=workflow%3ACI+branch%3Amaster)[![Coverage Status](https://camo.githubusercontent.com/e06dc542df3315b75e3840bd3fae3b12c534cf9b701d7a841e320bd39a9034bf/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6e65706164612f66696c652d75706c6f61642d636f6e74726f6c2f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/nepada/file-upload-control?branch=master)[![Downloads this Month](https://camo.githubusercontent.com/9ef0d19f75ecc8600ef876ba66970fa754af3416363b4a2949317162bf76ab3a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6e65706164612f66696c652d75706c6f61642d636f6e74726f6c2e737667)](https://packagist.org/packages/nepada/file-upload-control)[![Latest stable](https://camo.githubusercontent.com/2b43829a919603788a7ec18d74ac6d22419d105f89cc8ffd130bd372195d8f20/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e65706164612f66696c652d75706c6f61642d636f6e74726f6c2e737667)](https://packagist.org/packages/nepada/file-upload-control)

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

[](#installation)

Via Composer:

```
$ composer require nepada/file-upload-control
```

### Register and configure container extension

[](#register-and-configure-container-extension)

The only required configuration option is `uploadDirectory`, which determines where are the uploaded files temporarily stored.

```
extensions:
    fileUploadControl: Nepada\Bridges\FileUploadControlDI\FileUploadControlExtension
fileUploadControl:
    uploadDirectory: %appDir%/../files/uploads
```

### Add factory method to your forms

[](#add-factory-method-to-your-forms)

#### Option A: install form container extension method via DI extension

[](#option-a-install-form-container-extension-method-via-di-extension)

```
fileUploadControl:
    registerExtensionMethod: true # defaults to false
```

This will register extension method `addFileUpload($name, $label = null): FileUploadControl` to `Nette\Forms\Container`.

#### Option B: use trait in your base form/container class

[](#option-b-use-trait-in-your-base-formcontainer-class)

You can also use `FileUploadControlMixin` trait in your base form/container class to add method `addFileUpload($name, $label = null): FileUploadControl`. You need to inject `FileUploadControlFactory` into every form/container you create, e.g. by combination of a common form factory service and decorator configuration for enabling injects.

Example:

```
services:
    - FormFactory
decorator:
    Form:
        inject: true
```

```
trait FormControls
{

    use \Nepada\Bridges\FileUploadControlForms\FileUploadControlMixin;

    public function addContainer($name)
    {
        $control = new Container;
        $control->injectFileUploadFactory($this->fileUploadControlFactory);
        $control->setCurrentGroup($this->getCurrentGroup());
        if ($this->currentGroup !== null) {
            $this->currentGroup->add($control);
        }
        return $this[$name] = $control;
    }

}

class Container extends \Nette\Forms\Container
{

    use FormControls;

}

class Form extends \Nette\Application\UI\Form
{

    use FormControls;

}

interface FormFactory
{

    public function create(): Form;

}
```

Usage
-----

[](#usage)

`FileUploadControl` provides a way to upload files similarly to the standard `Nette\Forms\Controls\UploadControl`. The main difference is that the files are uploaded in chunks via AJAX requests into the temporary storage. This means you can upload multiple large files without the risk of running into server-side file/POST size limits. After submitting the form, the form control's value is set to a list of `FileUpload` instances of previously uploaded files in temporary storage.

### Configuration

[](#configuration)

The DI extension supports to following configuration options:

```
fileUpload:
    uploadDirectory: path/to/temp/storage # required, no default value
    registerExtensionMethod: true # defaults to false
    templateFile: path/to/alternative/control-template.latte # defaults to the bundled Bootstrap 4 template
    thumbnails: # image thumbnail settings
        enable: true
        width: 200
        height: 150
```

The package includes templates and styles build for Bootstrap [version 4](https://getbootstrap.com/docs/4.6/) and [version 5](https://getbootstrap.com/docs/5.3/). By default, version 4 is used, but to improve forward compatibility you should always explicitly specify which version you'd like to be used:

```
fileUpload:
    templateFile: Nepada\FileUploadControl\FileUploadControl::TEMPLATE_FILE_BOOTSTRAP4
    # or for Bootstrap 5
    # templateFile: Nepada\FileUploadControl\FileUploadControl::TEMPLATE_FILE_BOOTSTRAP5
```

### Validation

[](#validation)

All standard Nette file upload related validations work as expected. Furthermore, you can limit the number of allowed uploads by "length" rules.

### Client side

[](#client-side)

This package comes with client side built on top of [blueimp-file-upload](https://yarnpkg.com/package/blueimp-file-upload). It is published as npm package [@nepada/file-upload-control](https://yarnpkg.com/package/@nepada/file-upload-control).

[![Bootstrap 4 theme](docs/example.png)](docs/example.png)

#### Using precompiled bundle

[](#using-precompiled-bundle)

Using precompiled bundles is the quick'n'dirty way of getting client side to work.

```

```

#### Building your own bundle

[](#building-your-own-bundle)

It is highly recommended to install the client side package via nmp and compile your own bundle.

Here is an example script for initialization of file upload control and Nette forms.

```
import Nette from 'nette-forms';
import initializeFileUploadControl from '@nepada/file-upload-control';

initializeFileUploadControl(Nette);

Nette.initOnLoad();
```

If you use Bootstrap 4 or 5, you can easily customize the default look by importing the source SCSS files into your Sass styles:

- [\_file-upload-control-module-bootstrap4.scss](src/assets/scss/_file-upload-control-module-bootstrap4.scss), see also available [variables](src/assets/scss/partials-bootstrap4/_variables.scss) for overrides
- [\_file-upload-control-module-bootstrap5.scss](src/assets/scss/_file-upload-control-module-bootstrap5.scss), see also available [variables](src/assets/scss/partials-bootstrap5/_variables.scss) for overrides

###  Health Score

54

—

FairBetter than 97% of packages

Maintenance79

Regular maintenance activity

Popularity28

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity82

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 50.9% 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 ~145 days

Recently: every ~168 days

Total

15

Last Release

175d ago

PHP version history (6 changes)v1.0.0PHP &gt;=7.4.0

v1.3.0PHP &gt;=7.4.0 &lt;8.2

v1.4.0PHP &gt;=7.4.0 &lt;8.3

v1.6.0PHP &gt;=8.1.0 &lt;8.4

v1.9.0PHP &gt;=8.1.0 &lt;8.5

v1.9.2PHP &gt;=8.1.0 &lt;8.6

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b4780fe328102c4572737db639653c29d3081d1d3e051467f00d7f09a776399?d=identicon)[xificurk](/maintainers/xificurk)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (171 commits)")[![xificurk](https://avatars.githubusercontent.com/u/117465?v=4)](https://github.com/xificurk "xificurk (165 commits)")

---

Tags

nettefileuploadform

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/nepada-file-upload-control/health.svg)

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

###  Alternatives

[kartik-v/yii2-widget-fileinput

An enhanced FileInput widget for Bootstrap 3.x, 4.x &amp; 5.x with file preview, multiple selection, and more features (sub repo split from yii2-widgets)

2286.8M95](/packages/kartik-v-yii2-widget-fileinput)[contributte/image-storage

Image storage for Nette framework

28749.3k1](/packages/contributte-image-storage)[ublaboo/image-storage

Image storage for Nette framework

2913.0k](/packages/ublaboo-image-storage)[delight-im/file-upload

Simple and convenient file uploads — secure by default

7210.7k2](/packages/delight-im-file-upload)[nasext/dependent-select-box

Dependent Select Box for Nette Framework.

21262.8k2](/packages/nasext-dependent-select-box)

PHPackages © 2026

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