title: Yii/PHP - How to Create Data Only Once?
body: <p>everyone. Just like my post, how to create a file only once?
  Here's FileController.php</p>
  
  <pre><code>public function actionCreate()
  {
      $model=new File;
      if(isset($_POST['File']))
      {
          $simpan=$model-&gt;nama_file=CUploadedFile::getInstance($model,'nama_file');
          if(empty($simpan)){
              $model-&gt;attributes=$_POST['File'];
              $model-&gt;save();
          }
          else{
          $model-&gt;attributes=$_POST['File'];
          $model-&gt;pengunggah=Yii::app()-&gt;user-&gt;id;
          $model-&gt;nama_file = CUploadedFile::getInstance($model, 'nama_file');
          if($model-&gt;save()){
              $simpan-&gt;saveAs(Yii::app()-&gt;basePath .
                  '/../files/' . $model-&gt;nama_file.'');
                  //Yii::app()-&gt;user-&gt;setFlash('success', "Data berhasil disimpan!");
              $this-&gt;redirect(array('view','id'=&gt;$model-&gt;id_file));
          }
          }
      }
  
      $this-&gt;render('create',array(
          'model'=&gt;$model,
      ));
  }
  </code></pre>
  
  <p>After a user create a file, he/she cannot create another, it only allows user to create only once. How to implement it? Thanks a lot</p>