tegarkurniawan

Update gambar

Oct 11th, 2014
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. if(isset($_POST['Portofolio']))
  2. {
  3. $cekfile=$model->picture=CUploadedFile::getInstance($model,'picture');
  4. if(!empty($cekfile)){
  5. $model->attributes=$_POST['Portofolio'];
  6. $model->save();
  7. }else{
  8. $model->attributes=$_POST['Portofolio'];
  9. $model->picture=CUploadedFile::getInstance($model,'picture');
  10. if($model->save()){
  11. $model->picture->saveAs(Yii::app()->basePath.self::URLUPLOAD.$model->picture.'');
  12. $this->redirect(array('view','id'=>$model->portofolio_id));
  13. }
  14. }
  15. }
  16.  
  17. $this->render('update',array(
  18. 'model'=>$model,
  19. ));
  20. }
Advertisement
Add Comment
Please, Sign In to add comment