webyjh
- webyjh 回复了话题 [已解决]提示找不到扩展
<table> <tr><td style='text-align:right;width:100px;'> <?php echo $form->labelEx($model,'front_img'); ?></td> <td> <?php echo $form->FileField($model, 'front_img',array('style'=>'width:300px;')); ?> </td> </tr> </table>
控制器中的代码
public function actionCreate() { $model=new News; // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation($model); if(isset($_POST['News'])) { $model->attributes=$_POST['News']; $model->front_img=CUploadedFile::getInstance($model,'front_img'); if($model->save()) { //按时间生成新文件名 $newName=date('YmdHis').'_'.rand(1,9).'.'.$model->front_img->extensionName; //设定上传目录 $path=yii::app()->basePath.'/../uploads/images/'.$newName; //上传图片 $model->front_img->saveAs($path); //利用扩展生成缩略图 $im = null; $imagetype = strtolower($model->front_img->extensionName); if($imagetype == 'gif') $im = imagecreatefromgif($path); else if ($imagetype == 'jpg') $im = imagecreatefromjpeg($path); else if ($imagetype == 'png') $im = imagecreatefrompng($path); CThumb::resizeImage($im,100, 100,'e:\\kanbox\\phpnow\\htdocs\\cnsstc' . $model->front_img->extensionName, $model->front_img->extensionName ); // redirect to success page $this->redirect(array('view','id'=>$model->id)); } } $this->render('create',array( 'model'=>$model, )); }
- webyjh 发布了话题[已解决]提示找不到扩展
有没有上面的写法?
<?php echo Yii::app()->request->baseUrl;?>
和<?php echo Yii::app()->baseUrl;?>
好像是一样的- webyjh 回复了话题 验证是否是注册用户,管理员是不是 这么写的?
还是决定在视图里写,要不然每个控制器里用到就要写,麻烦啊
- webyjh 回复了话题 fckEditor插件出了错
谢谢,原来是
'toolbarSet' => 'full',
- webyjh 发布了话题如何安全的使用FckEditor?
- webyjh 回复了话题 fckEditor插件出了错
应该没有,干脆去掉了,不折腾了