PHPackages                             tacoberu/nette-form-fileupload - 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. tacoberu/nette-form-fileupload

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

tacoberu/nette-form-fileupload
==============================

Uploading files has its specifics. It is not enough just to upload the file. We also want to show it when it's already uploaded (preferably with a preview). We want to possibly delete it or replace it with another version.

v1.0.1(2y ago)0420↓50%MITPHPPHP &gt;=8.1

Since Apr 25Pushed 1y ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (4)Used By (0)

Nette form FileControl
======================

[](#nette-form-filecontrol)

Uploading files is easy. But if we have the file already uploaded in the system, we can want

- only display it (preferably with a preview),
- or delete the file,
- or replace the file with another version.

A somewhat inconvenient situation is when we get some unrelated error elsewhere in the form. So we return the form for the user to correct it. But the uploaded file or files must be restarted. We solve this with a transaction. Once uploaded, the file is stored in a special storage (by default it is handled as a tempo directory, it can be changed), and entered into the system after successfully saving the form.

We represent image files as images. If the standard renderer is not suitable, we can set our own.

The input value can have three options:

- `Null`: none, or original file deleted
- `FileUploaded`: new file uploaded
- `FileCurrent`: the original file stored in the system

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

[](#installation)

```
composer require tacoberu/nette-form-fileupload

```

### Use

[](#use)

```
use Taco\Nette\Forms\Controls\FileCurrent;
use Taco\Nette\Forms\Controls\FileControl;
use Taco\Nette\Forms\Controls\GenericFilePreviewer;

$form = new Nette\Forms\Form;

$form['portrait'] = (new FileControl('Portrait:'))
	->setDefaultValue(new FileCurrent("uploaded/account/56695/mp16.jpg", "image/jpeg"))
	->setPreviewer(new GenericFilePreviewer());
```

### Transactions

[](#transactions)

When the file is successfully uploaded to the server, it is automatically moved to the storage, transaction. This will serve to if the form is not processed, but is, for example, passed back to the user for validation reasons, it is not necessary to upload the file again. After successful processing, the file is available using $control-&gt;getValue() like the other values.

After the file is uploaded to the system, the transaction can be discarded. Well, in case using the default storage `UploadStoreTemp`, delete the directory. We can either do this explicitly:

```
$form['portrait']->destroyStore();
```

Or leave it to the GC, which will delete it automatically after a certain period of time.

#### UploadStoreTemp, GC

[](#uploadstoretemp-gc)

Automatic greasing is implemented in `UploadStoreTemp`. it acts like that after the page exits, all relevant transactions are passed through the destructor and checks if the transaction is older than `UploadStoreTemp::$gcAgeLimit`. This only deletes `UploadStoreTemp::$gcMaxCount` transactions/directories to spread the load.

This behavior is only a matter of the `UploadStoreTemp` implementation.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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 ~15 days

Total

3

Last Release

723d ago

### Community

Maintainers

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

---

Top Contributors

[![tacoberu](https://avatars.githubusercontent.com/u/1828339?v=4)](https://github.com/tacoberu "tacoberu (16 commits)")

---

Tags

netteformfileupload

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/tacoberu-nette-form-fileupload/health.svg)

```
[![Health](https://phpackages.com/badges/tacoberu-nette-form-fileupload/health.svg)](https://phpackages.com/packages/tacoberu-nette-form-fileupload)
```

###  Alternatives

[oneup/uploader-bundle

This Symfony bundle provides a server implementation for handling single and multiple file uploads using either FineUploader, jQuery File Uploader, YUI3 Uploader, Uploadify, FancyUpload, MooUpload, Plupload or Dropzone. Features include chunked uploads, orphanages, Gaufrette and Flysystem support.

6066.3M27](/packages/oneup-uploader-bundle)[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)[nette/safe-stream

Nette SafeStream: provides isolation for thread safe manipulation with files via native PHP functions.

1174.9M140](/packages/nette-safe-stream)[servocoder/richfilemanager

RichFilemanager - highly customizable open-source file manager

90962.0k2](/packages/servocoder-richfilemanager)[phery/phery

XAJAX alternative, phery.js is a library in PHP that maps to all jQuery functions, DOM manipulation, meta arguments and serialization, seamless ajax integration, RESTful emulation, form submission and partial rendering views, plus its PSR-0 compatible

13813.1k2](/packages/phery-phery)[tomaj/nette-bootstrap-form

Nette bootstrap form renderer

28440.4k6](/packages/tomaj-nette-bootstrap-form)

PHPackages © 2026

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