【问题标题】:jQuery File Upload Plugin in CakePHPCakePHP 中的 jQuery 文件上传插件
【发布时间】:2013-08-15 12:54:00
【问题描述】:

我正在尝试在我的 CakePHP 项目中使用这个 jQuery File Upload 插件: http://blueimp.github.io/jQuery-File-Upload/ 该演示运行良好,当我将插件中的“服务器”文件夹放在我的 CakePHP webroot 目录中时,它也适用于我的 CakePHP 项目。但这样它会上传 webroot/server/php/files 中的图像。我希望能够上传 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/'

【问题讨论】:

标签: php cakephp cakephp-2.0 jquery-file-upload


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-15
    • 1970-01-01
    • 2012-01-30
    • 1970-01-01
    • 2013-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多