Download the PHP package studio255/yii2-fileupload without Composer
On this page you can find all versions of the php package studio255/yii2-fileupload. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download studio255/yii2-fileupload
More information about studio255/yii2-fileupload
Files in studio255/yii2-fileupload
Package yii2-fileupload
Short Description FilePond-based file upload widget for Yii2 — chunked uploads, ActiveRecord binding and image variants.
License MIT
Homepage https://github.com/studio255/yii2-fileupload
Informations about the package yii2-fileupload
yii2-fileupload
FilePond-based file upload widget for Yii2 — chunked uploads, ActiveRecord binding, and image variants out of the box.
Features
- FilePond widget — drop-in Yii2 widget with auto-initialization for plain
<input>fields - Chunked uploads — enabled by default, bypasses PHP
post_max_sizelimits - Multiple files — configurable file count and MIME type filters
- ActiveRecord binding — auto-assigns filenames to model attributes after upload
- Image variants — optional server-side resizing (GD-based, keeps PNG transparency)
- CSRF support — sends
X-CSRF-Tokenheader automatically
Installation
Quick Start
1. Widget in a view
2. Controller action
Widget Options
| Option | Type | Default | Description |
|---|---|---|---|
id |
string | 'filepond' |
HTML id of the input |
url |
string | — | Upload URL |
multiple |
bool | true |
Allow multiple files |
maxFiles |
int|null | 5 |
Maximum number of files |
acceptedFiles |
string|null | null |
Accepted MIME types / extensions |
model |
array | [] |
Extra URL parameters passed to the server |
options |
array | [] |
Additional FilePond options (see below) |
Common options keys:
| Key | Default | Description |
|---|---|---|
chunkUploads |
true |
Enable chunked uploads |
chunkSize |
1048576 |
Chunk size in bytes (1 MB) |
extraData |
[] |
Additional form fields sent with each upload |
UploadHandler Options
Where files are saved
- Default:
@webroot/uploads/<filename> - With
model_idparam:@webroot/uploads/{model_id}/<filename>
The subfolder is cleared before saving (passemptyIdFolder=0to disable).
Multiple Instances
Use options['instances'] to mount several FilePond ponds from a single widget call:
Plain <input> (no widget)
The JS helper auto-initializes every <input class="filepond"> on DOM ready via data-* attributes:
| Attribute | Description |
|---|---|
data-url |
Upload endpoint |
data-multiple |
"true" / "false" |
data-accepted |
Accepted MIME types |
data-maxfiles |
Max number of files |
data-model-id |
Sent to server as subfolder ID |
Chunked Upload Protocol
The handler implements the FilePond TUS-like protocol automatically:
| Request | Purpose |
|---|---|
POST (no files, Upload-Length header) |
Init — returns a temp file ID |
HEAD ?patch=<id> |
Resume — returns current Upload-Offset |
PATCH ?patch=<id> |
Append chunk — finalizes on last chunk |
The CSRF token is sent as X-CSRF-Token from <meta name="csrf-token">. No extra configuration needed for standard Yii2 setups.
Notes
- Filenames are sanitized server-side: only
A–Z a–z 0–9 - _plus a lowercase extension are kept. German umlauts are transliterated (ä→ae, etc.). - Image variants require the GD extension. Input formats: JPG, PNG, GIF. PNG output preserves transparency; all others are saved as JPEG at quality 90.
- Assets (FilePond CSS/JS) are registered automatically by the widget.
License
MIT