Yii Framework Forum: Rename File Upload For Download - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Rename File Upload For Download rename file upload for download Rate Topic: ***** 1 Votes

#1 User is offline   han2 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 45
  • Joined: 12-November 12

Posted 17 September 2013 - 04:41 AM

para master yii sekalian mau tanya nih..ceritanya ane mau download file yang udah kesimpen di database.file itu di dapet dari hasil upload file.nah sintaks upload ane begini:
public function actionCreate()
        {
                $model=new Naskah;
                if(isset($_POST['Naskah']))
                {
                        $model->attributes=$_POST['Naskah'];
                        $model->lampiran=CUploadedFile::getInstance($model,'lampiran');
                        
                        if($model->save())
                                $model->lampiran->saveAs(Yii::app()->basePath . '/../files/' .'.jpg');
                                $this->redirect(array('sent','id'=>$model->id_naskah));
                }

                $this->render('create',array(
                        'model'=>$model,
                        //'model'=>$this->loadModel($id_naskah),
                ));
        }



nah jadi file yang di upload itu berhasil kesimpen ke dalam folder 'files' dan di database namanya udah sesuai.tapi permasalahannya adalah file yang kesimpen ke folder 'files' itu nggak ada namanya.ada yang bisa kasih solusi? terimakasih kalo mau menjawab :D
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users