jedenweb / plupload
Plupload based file upload for Nette Framework
Installs: 66
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 1
Open Issues: 0
Language:JavaScript
Requires
- nette/application: ^2.4
- nette/di: ^2.4
- nette/http: ^2.4
Suggests
- webchemistry/images: ^2.1
This package is auto-updated.
Last update: 2025-01-27 22:32:54 UTC
README
Use original repo instead.
Plupload
Simple file uploader for Nette Framework
Originaly from Nikolas Tsiongas, new BSD License.
Instalation
Plupload requires jQuery and jQueryUI.
The best way to install jedenweb/images is using Composer:
{ "require" { "jedenweb/plupload": "dev-master" } }
After that you have to register extension in config.neon.
extensions: plupload: JedenWeb\Plupload\DI\PluploadExtension
Usage
Creating component
In presenter
/** * @inject * @var \JedenWeb\Plupload\Plupload */ public $plupload; /** * @param string $name * @return \JedenWeb\Plupload\Widget\JQueryUIWidget */ public function createComponentPlupload($name) { $this->plupload->getUploader() ->onSuccess[] = callback($this, 'handleUploadFile'); return $this->plupload; } /** * @param \Nette\Http\FileUpload $file */ public function handleUploadFile(\Nette\Http\FileUpload $file) { $file->move(WWW_DIR . '/media/upload/'. $file->getSanitizedName()); $this->invalidateControl('images'); }
Dummy way to show uploaded files
In presenter
public function actionDefault() { $this->template->images = \Nette\Utils\Finder::find('*')->from(WWW_DIR . '/media/upload'); }
In template
{control plupload} {snippet images} {foreach $images as $image} <img src="{$basePath}/media/upload/{$image->getFilename()}" /> {/foreach} {/snippet}