cakephp file upload (jpg, pdf). file extension send in a field of database. How can i do it???
First of all, your form need this:
echo $this->Form->create($entity, ['type' => 'file']);
Now, at the controller:
$entity = $this->Table->patchEntity($entity, $this->request->data); $entity->binary_filed = @file_get_contents($this->request->data['binary_field']['tmp_name']);