Hi,
I want to upload a file using the xheditor, so i added this in the view:
<?php $this->widget('application.extensions.xheditor.JXHEditor', array(
'model'=>$model,
'attribute'=>'image',
'options'=>array(
'id'=>'xh1',
'name'=>'xh',
'tools'=>'simple', // mini, simple, full or from XHeditor::$_tools
'width'=>'100%',
'skin'=>'o2007silver',
'emot'=>'msn',
'upImgUrl'=> 'create' // the action name in the controller
//see XHeditor::$_configurableAttributes for more
),
'htmlOptions'=>array('cols'=>80,'rows'=>20,'style'=>'width: 100%; height: 200px;'),
));
?>
In my controller i have this:
$model=new Item;
if(isset($_POST['Item']))
{
$model->attributes=$_POST['Item'];
$model->image=CUploadedFile::getInstance($model,'image');
if($model->save())
{
$model->image->saveAs('./myfiles');
}
}
$this->render('create', array('model'=>$model));
in the model
public $image;
public function rules()
{
return array(
array('image','file','types'=>'jpg, gif, png'),
);
}
but i have this following error: [color="#FF0000"]create upload interface error, return error[/color]: // blank
Do you have an idea how can i solve this problem?
Thanks