connect232 / cakephp-upload
Upload plugin for CakePHP
Installs: 18
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:cakephp-plugin
Requires
- cakephp/cakephp: ^4.0
Requires (Dev)
- phpunit/phpunit: ^5.7.14|^6.0
README
Installation
Run:
composer require connect232/cakephp-upload
Usage
Run : bin/cake plugin load Upload
Or in your src/Application.php
add:
$this->addPlugin('Upload');
In your model initialize()
:
$this->addBehavior('Upload.Upload', [
'your_field_name' => [
'path' => 'directory/to/save/file/to'
]
]
);
If you have baked your model remove the scalar validation:
$validator->scalar('foo');
Modify your form to accept files
$this->Form->create($foo, ['type' => 'file']);
Modify your field's type to file
$this->Form->control($foo, ['type' => 'file']);