2017 © Pedro Peláez
 

cakephp-plugin cakephp-jquery-file-upload

Cakephp 3.x Jquery File Upload

image

hashmode/cakephp-jquery-file-upload

Cakephp 3.x Jquery File Upload

  • Tuesday, August 2, 2016
  • by hashmode
  • Repository
  • 2 Watchers
  • 6 Stars
  • 746 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 2 Open issues
  • 7 Versions
  • 9 % Grown

The README.md

Cakephp-Jquery-File-Upload

This is a Cakephp 3.x vendor/plugin for blueimp jquery file upload widget https://github.com/blueimp/jQuery-File-Upload, (*1)

Requirements

  1. Cakephp 3.x
  2. Blueimp Jquery File Upload - https://github.com/blueimp/jQuery-File-Upload (dependency is added into the plugin's composer, so it wil be automaticaly installed)

Installation

1) Installation is done by composer: add the following into your main composer.json (inside require) and then run composer update, (*2)

"hashmode/cakephp-jquery-file-upload": "~1.0"

To use the css and js files from the original library, they are being copied to plugin's webroot directory: for that inside your application's main composer.json the following should be added, (*3)

"scripts": {
    "post-update-cmd": "CakephpJqueryFileUpload\\Console\\Installer::postUpdate"
},

2) Load Plugin from bootstrap, and add component into controller, helper - to AppView, (*4)

// bootstrap.php
Plugin::load('CakephpJqueryFileUpload');

// inside your controller's initialize
$this->loadComponent('CakephpJqueryFileUpload.JqueryFileUpload');

// inside AppView.php initialize
$this->loadHelper('CakephpJqueryFileUpload.JqueryFileUpload');

3) To add the UploadHelper class to autoload classmap, add this into your main composer - under autoload, same level as psr-4, (*5)

"classmap": [
    "vendor/blueimp/jquery-file-upload/server/php"
]        

and run composer dump-autoload, (*6)

4) Simple setup example, (*7)

JqueryFileUpload->loadCss(); ?>
JqueryFileUpload->loadScripts(); ?>

<span class="btn btn-success fileinput-button">
    <i class="glyphicon glyphicon-plus"></i>
    <span>Select files...</span>
    <!-- The file input field used as target for the file upload widget -->
    <input id="fileupload" type="file" name="files[]" multiple>
</span>






inside your myAction, (*8)

// example options
$options = array(
    'max_file_size' => 2048000,
    'max_number_of_files' => 10,
    'access_control_allow_methods' => array(
        'POST'
    ),
    'access_control_allow_origin' => Router::fullBaseUrl(),
    'accept_file_types' => '/\.(jpe?g|png)$/i',
    'upload_dir' => WWW_ROOT . 'files' . DS . 'uploads' . DS,
    'upload_url' => '/files/uploads/',
    'print_response' => false
);

$result = $this->JqueryFileUpload->upload($options);

For full $options please refer to https://github.com/blueimp/jQuery-File-Upload, (*9)

License

MIT, (*10)

The Versions

02/08 2016

dev-master

9999999-dev

Cakephp 3.x Jquery File Upload

  Sources   Download

MIT

The Requires

 

by Avatar hashmode

cakephp jquery file-upload

02/08 2016

v1.0.3

1.0.3.0

Cakephp 3.x Jquery File Upload

  Sources   Download

MIT

The Requires

 

by Avatar hashmode

cakephp jquery file-upload

29/07 2016

v1.0.2

1.0.2.0

Cakephp 3.x Jquery File Upload

  Sources   Download

MIT

The Requires

 

by Avatar hashmode

cakephp jquery file-upload

28/04 2016

v1.0.1

1.0.1.0

Cakephp 3.x Jquery File Upload

  Sources   Download

MIT

The Requires

 

by Avatar hashmode

cakephp jquery file-upload

28/04 2016

v1.0.0

1.0.0.0

Cakephp 3.x Jquery File Upload

  Sources   Download

MIT

The Requires

 

by Avatar hashmode

cakephp jquery file-upload

27/04 2016

v0.1.2

0.1.2.0

Cakephp 3.x Jquery File Upload

  Sources   Download

MIT

The Requires

 

by Avatar hashmode

cakephp jquery file-upload

27/04 2016

v0.1.1

0.1.1.0

Cakephp 3.x Jquery File Upload

  Sources   Download

MIT

The Requires

 

by Avatar hashmode

cakephp jquery file-upload