0

我正在尝试将 CUploadedFile 对象保存在本地文件夹中,我正在为 yii 使用 img 模块。我收到此错误:

CException Property "Image.path" is read only. 

在堆栈跟踪中,它显示这是导致错误的原因:

CActiveRecord->__set("path", "show_gallery"):

public function save($file,$name=null,$path=null)
{
 ....
if($path!==null)
      $image->path=trim($path,'/');
 ...

它是由以下原因引起的:

ImgManager->save(CUploadedFile, "some_name", "show_gallery"):

Yii::app()->image->save($modelPhoto->content,'some_name','show_gallery'); 
4

1 回答 1

1

这表明 Image 类的属性是只读的,这也意味着该属性没有名为 path 的 setter 方法。它与文件系统无关,而与代码有关。

您使用的是第 3 方扩展程序吗?你能提供整个图像模型代码吗?

于 2012-06-13T12:58:01.163 回答