1. Go to this page and download the library: Download fusic/filebinder library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fusic / filebinder example snippets
CakePlugin::load('Filebinder');
## Filebinder outline image
Filebinder manage 'virtual table' and entity.
### 'Simple attachment' model image

### 'Multi fields' model image

### 'Multi models' model image

### Entity file path image

## Usage
Example of how to add image file with confirm page.
class Post extends AppModel {
public $name = 'Post';
public $actsAs = array('Filebinder.Bindable');
public $displayField = 'title';
public $bindFields = array(array('field' => 'image',
'tmpPath' => '/var/www/html/myapp/app/webroot/files/cache/',
'filePath' => '/var/www/html/myapp/app/webroot/files/',
));
public $validate = array('title' => array('notempty'),
'image' => array('allowExtention' => array('rule' => array('checkExtension', array('jpg')),
'allowEmpty' => true),
'illegalCode' => array('rule' => array('funcCheckFile', 'checkIllegalCode'),
'allowEmpty' => true))
);
/**
* checkIllegalCode
* check /
public function add_success(){
$this->Transition->checkPrev(array('add',
'add_confirm'));
$mergedData = $this->Transition->mergedData();
if ($this->Post->save($mergedData)) {
$this->Transition->clearData();
$this->Session->setFlash(sprintf(__('The %s has been saved', true), 'post'));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(sprintf(__('The %s could not be saved. Please, try again.', true), 'post'));
$this->redirect(array('action' => 'add'));
}
}
}
add.ctp
<div class="posts form">
<h2> printf(__('Add %s', true), __('Post', true));