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.3(1mo ago)85.2k↓53.3%1[1 issues](https://github.com/nepada/file-upload-control/issues)BSD-3-ClausePHPPHP &gt;=8.1.0 &lt;8.6CI failing

Since Apr 25Pushed 2w 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 2w ago

READMEChangelog (10)Dependencies (42)Versions (25)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://www.npmjs.com/package/blueimp-file-upload). It is published as npm package [@nepada/file-upload-control](https://www.npmjs.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

58

—

FairBetter than 98% of packages

Maintenance93

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity84

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 50.3% 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 ~151 days

Recently: every ~222 days

Total

16

Last Release

30d 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] (179 commits)")[![xificurk](https://avatars.githubusercontent.com/u/117465?v=4)](https://github.com/xificurk "xificurk (177 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

[nette/web-project

Nette: Standard Web Project

11093.7k](/packages/nette-web-project)[tomaj/nette-api

Nette api

36276.9k8](/packages/tomaj-nette-api)[contributte/image-storage

Image storage for Nette framework

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

Image storage for Nette framework

2914.2k](/packages/ublaboo-image-storage)[nepada/form-renderer

Latte template based form renderer for Nette forms with full support for Bootstrap 3, 4 &amp; 5.

11254.5k](/packages/nepada-form-renderer)[nextras/forms-rendering

Rendering helpers for Nette Framework Forms.

16105.1k2](/packages/nextras-forms-rendering)

PHPackages © 2026

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