【发布时间】:2016-12-21 10:37:26
【问题描述】:
此代码在本地服务器中运行良好,但在实时服务器中我收到禁止错误 403。如果我提到表单类型 = 'post',它在服务器中运行。但文件没有上传。如果我使用 'type'=>'file' 则会出现 Forbidden 错误。这是我的表单代码
<?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()
?>
我的控制器代码像
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)
如何定义这个表单类型是文件,类型也是帖子。
【问题讨论】:
-
你启用调试模式了吗?
-
我的“调试”=> 假
-
请启用它并再次检查。你会得到错误。
-
这里 from 没有发送到控制器,我已经在控制器中调试过,如果我使用 type = file,它就不会从那里发送。它可能是apache权限问题。可能我必须在 htaccess 中做一些事情,但我不知道该怎么做。
标签: cakephp cakephp-3.0 cakephp-3.x