This code working fine in local server but in live server I am getting Forbidden error 403. If I mention form type = 'post' it's working in server. but file not uploading. If I use 'type'=>'file' then getting Forbidden error. Here is my form code
<?php
echo $this->Form->create($depositOption,['type'=>'file']); // type='post' is working but image not uploading
echo $this->Form->input('name');
echo $this->Form->input('image_edit',['type'=>'file']);
echo $this->Form->submit("Submit")
echo $this->Form->end()
?>
My controller code like
if ($this->request->is(['patch', 'post', 'put'])) {
if(!empty($this->request->data['image_edit']['name'])){
// upload image code
}
}
$depositOption = $this->DepositOptions->patchEntity($depositOption, $this->request->data);
$this->DepositOptions->save($depositOption)
How to define this form type is file also type is post.
Did you try this ? Add enctype using form option