CakePHP中的jQuery文件上传插件


jQuery File Upload Plugin in CakePHP

我正试图在我的CakePHP项目中使用这个jQuery File Upload插件:http://blueimp.github.io/jQuery-File-Upload/这个演示效果很好,当我把插件中的"服务器"文件夹放在CakePHP webroot目录中时,它也适用于我的CakePHP项目。但通过这种方式,它将图像上传到webroot/server/php/文件中。我希望能够上传webroot/img中的文件,因为这是CakePHP用于图像的目录。

我找到了以下配置行,但我不知道如何更改此参数以提高几个级别,或者从webroot开始。这似乎取决于脚本文件所在的位置,我对这些变量真的很不好,有人能帮我吗?

function __construct($options = null, $initialize = true, $error_messages = null) 
{$this->options = array(
'script_url' => $this->get_full_url().'/',            
'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/',
'upload_url' => $this->get_full_url().'/files/'

请尝试在选项中更改此代码。

$this->options = array(
'script_url' => $this->get_full_url().'/',            
'upload_dir' => WWW_ROOT.'/img/',
'upload_url' => $this->get_full_url().'/img/'