public function actionCreate()
{
$model = new ARBiz('sell');
// dump($model);
$this->performAjaxValidation($model);
if (!empty($_POST)) {
// dump($_POST);
$model->attributes = $_POST['ARBiz'];
//创建者
$model->create_id = Yii::app()->user->id;
// dump($_FILES);
// 控制器中使用实例如下:
$upload = new FileUpload(array($model, 'license_photo'), 'upload/groupon');
//model处理文件上传 $upload = new FileUpload(array($model,'pic'),'upload/goods');
if (!$upload->isNull()) {
if ($filename = $upload->save()) {
$model->license_photo = $filename;
// dump($filename);
} else {
print_r($upload->getErrors());
throw new CHttpException('300', '文件上传失败');
}
}
if ($model->save()) {
$this->go('商家添加成功', array('index'), 'success');
}
}
$this->render('create', array('model' => $model));
}