我已经尝试了几个 CakePHP 文件上传器,但在设置和使其工作方面都没有成功。我已经使用Miles Uploader Plugin安定下来,我正在尽我所能让它发挥作用。安装说明非常好,我已经完全按照它们进行操作,但我仍然无法让它工作。
当我发布文章时,我收到以下错误:
Warning (2): Illegal offset type in isset or empty [APP/plugins/uploader/controllers/components/uploader.php, line 1104]
}
if (isset($this->_data[$file])) {
我正在添加文章视图中进行以下调用
...
echo $form->input('main_image', array('type' => 'file'));
...
我在我的添加操作中使用了以下内容,但它返回 false
...
if (!empty($this->data)) {
//This call is not successful which skips to the }else{ display the message below
if ($data = $this->Uploader->upload('main_image')) {
// Upload successful, do whatever
}else{
$this->setFlash('Uploader Error',true);
}
}
...
任何人都可以请阐明什么可能是错误的。
** 编辑 **
我现在无法尝试此操作,但我需要执行以下操作以使其正常工作:
if ($data = $this->Uploader->upload(data['Article']['main_image'])) {
谢谢,