2011-07-13 31 views
1

我尝试了几个CakePHP文件上传器,但没有成功'设置并使其工作。我已经用Miles Uploader Plugin安顿下来了,我正在尽我所能让它工作。安装说明非常好,我已跟随他们的信,但我仍然无法得到它的工作。CakePHP - Miles上传插件 - Isset错误

当我张贴的文章我收到以下错误:

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')); 
... 

而且我用我的附加动作以下但它是错误的返回

... 
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'])) { 

谢谢,

回答

1

花了很多小时试图找出它为什么不起作用。最后,我放弃了昨晚的尝试并试图配置CakePHP的媒体插件。现在效果很好。安装非常轻松。