I am using the cakephp-upload plugin and I managed to upload images to my server:
WorkersTable:
public function initialize(array $config)
{
parent::initialize($config);
$this->table('workers');
$this->displayField('id');
$this->primaryKey('id');
$this->addBehavior('Josegonzalez/Upload.Upload', [
'avatar' => [
'fields' => [
'dir' => 'photo_dir'
]
]
]);
}
view.ctp:
echo $this->Form->create($newWorker, ['type' => 'file']);
echo $this->Form->input('avatar', ['type' => 'file']);
echo $this->Form->input('photo_dir', ['type' => 'hidden']);
Now the avatar images are uploaded, but they are not put into the photo_dir subdirectory.
What am I missing? It works without any problems in my CakePHP 2.8.x application.
photo_dir
is a column in the workers table. – Booth