为什么cakephp图像上传器插件不工作?

为什么cakephp图像上传器插件不工作?,cakephp,Cakephp,我试图在ajax调用期间上传图像。为此,我使用了一个插件来创建拇指指甲,但它并没有插入任何数据和缩略图 我将给出我的插件链接以及控制器代码和型号: 和型号代码: public $actsAs = array( 'Upload.Upload' => array( 'picture' => array( 'path' => '{ROOT}webroot{DS}img{DS}{model}{DS}{field}{DS}',

我试图在ajax调用期间上传图像。为此,我使用了一个插件来创建拇指指甲,但它并没有插入任何数据和缩略图

我将给出我的插件链接以及控制器代码和型号:

和型号代码:

public $actsAs = array(
     'Upload.Upload' => array(
          'picture' => array(
           'path' => '{ROOT}webroot{DS}img{DS}{model}{DS}{field}{DS}',
             'fields' => array(
               'dir' => 'picture_dir'
                 ),                
                 'thumbnailSizes' => array(
                    'thumb' => '100x100'
                  ), 'thumbnailMethod' => 'php'
          )
     )
  );
我的视图文件是:

$this->Form->create($id, array('type' => 'file', "id" => "multiform"));
$this->Form->input('picture', array('type' => 'file'));
$this->Form->button('Upload', array('type' => 'submit', "id" => "club_upload"));
$this->Form->end();
它不会在数据库中创建缩略图和数据。我被困在这上面了,任何想法都会对我有帮助。

这应该行得通:

public $actsAs = array(
    'Upload.Upload' => array(
        'path' => '{ROOT}webroot{DS}img{DS}{model}{DS}{field}{DS}',
        'fields' => array(
            'dir' => 'picture_dir'
        ),
        'thumbnailSizes' => array(
            'thumb' => '100x100'
        ),
        'thumbnailMethod' => 'php',
        'deleteOnUpdate'  => true
    )
);
编辑:

在视图文件中:

$this->Form->create('Photo', array('type' => 'file', "id" => "multiform"));
id
作为表单名传递是个坏主意

现在,您可以通过以下方式访问数据:

 $this->request->data['Photo']['picture']

您可能已经为
俱乐部id
字段添加了表单。

是否收到任何错误(错误/调试日志)?在没有ajax的情况下上传图片,有什么帮助吗?因为通过ajax上传图像需要与标准POST请求稍有不同的代码:)不,我没有收到任何错误!它不能工作,不能将任何数据保存到数据库中,也不能创建任何folder@CrazyMan你能用表单添加视图文件吗?@CrazyMan有错误吗?检查
app/tmp/logs/error.log
 $this->request->data['Photo']['picture']