0
我正在用我的Cake 2.1應用程序設置Media Plugin。我之前使用過Cake 2.0的插件,並沒有遇到任何問題。CakePHP Media插件錯誤
Fatal error: Call to a member function pwd() on a non-object in /home/fractalw/public_html/cms/app/Plugin/Media/Model/Behavior/CouplerBehavior.php on line 141
這是我的bootstrap.php文件的相關部分:現在,當我嘗試上傳文件我收到此錯誤信息 CakePlugin ::負載(「媒體」);
require APP . 'Plugin' . DS . 'Media' . DS . 'Config' . DS . 'core.php';
$thumbnail = array('fitCrop' => array(100, 100));
$small = array('fitCrop' => array(200, 200));
$large = array('fit' => array(700, 10000));
$smallthumbnail = array('fitCrop' => array(75, 75));
$tinythumbnail = array('fitCrop' => array(35, 35));
Configure::write('Media.filter', array('default' => array(
'audio' => array(),
'document' => array(),
'generic' => array(),
'image' => compact('small', 'thumbnail', 'smallthumbnail', 'large', 'tinythumbnail'),
'video' => compact('medium', 'large')
)));
...和我的模型,File.php:
public $actsAs = array(
'Media.Transfer',
'Media.Coupler',
'Media.Generator',
'Media.GeneratedDeletable',
'Media.Meta',
'Containable'
);
public $validate = array(
'file' => array(
'mimeType' => array(
'rule' => array('checkMimeType', false, array('image/jpeg', 'image/png', 'image/gif'))
)
)
);
我得到上面時,我提交上傳文件的格式錯誤消息。 CouplerBehavior.php中有問題的行是:
str_replace('\\', '/', Folder::slashTerm($File->Folder->pwd()))
至少你沒有命名你的模型對象... –