jaimevalasek / jv-upload
A generic Upload files module for ZF2.
Requires
- php: >=5.3.3
- jaimevalasek/jv-easy-php-thumbnail: dev-master
- jaimevalasek/jv-mime-types: dev-master
- zendframework/zendframework: 2.*
This package is not auto-updated.
Last update: 2025-05-06 07:29:43 UTC
README
Create By: Jaime Marcelo Valasek
Use this module to upload files.
Futures video lessons can be developed and published on the website or Youtube channel http://www.zf2.com.br/tutoriais - http://www.youtube.com/zf2tutoriais
Installation
Download this module into your vendor folder.
After done the above steps, open the file config/application.config.php
. And add the module with the name JVUpload
.
Pendencies modules
- To use the module you must also install the following modules:
JVConfig - https://github.com/jaimevalasek/JVConfig JVEasyPhpThumbnail - https://github.com/jaimevalasek/JVEasyPhpThumbnail JVMimeTypes - https://github.com/jaimevalasek/JVMimeTypes
With composer
- Add this project and JVEasyPhpThumbnail + JVMimeTypes + JVConfig in your composer.json:
"require": { "jaimevalasek/jv-upload": "dev-master" }
- Now tell composer to download JVUpload by running the command:
php php composer.phar update
Post installation
1.Enabling it in your application.config.php
.
<?php return array( 'modules' => array( // ... 'JVConfig', 'JVEasyPhpThumbnail', 'JVMimeTypes', 'JVUpload', ), // ... );
- Configure the array configuration module JVConfig or in your main module
<?php return array( // ... 'jv-upload' => array( 'types' => array( 'image', 'audio', 'video', 'app', 'thumb', 'text', 'file', 'custom' ), ), // ... );
Using the JVUpload
Basic image example
$upload = new \JVUpload\Service\Upload($this->getServiceLocator()->get('servicemanager')); $upload->setType('image') ->setThumb(array('destination' => '/conteudos/thumbs', 'width' => 200, 'height' => 250, 'cropimage' => array(2,0,40,40,50,50))) ->setExtValidation('ext-image-min') ->setSizeValidation(array('18', '200')) // validation of the file size in KB array (min max). ->setDestination('/conteudos/imagens') ->prepare()->execute();