title: Upload file Yii The second argument to copy() function cannot be a directory
body: <p>I'm trying to upload file but get this error message :</p>
  
  <pre><code> move_uploaded_file() [&lt;a href='function.move-uploaded-file'&gt;function.move-uploaded-file&lt;/a&gt;]: The second argument to copy() function cannot be a directory 
  </code></pre>
  
  <p>I think there's something problem with this file but I've no idea to solve it..</p>
  
  <pre><code>    &lt;?php
  
  
      class FileUploadController extends CController {
  
  
      public function actionUpload() {
          $model = new FileUpload();
      $form = new CForm('application.views.fileUpload.uploadForm', $model);
          if ($form-&gt;submitted('submit') &amp;&amp; $form-&gt;validate()) {
              $form-&gt;model-&gt;image = CUploadedFile::getInstance($form-&gt;model, 'image');
  
  
                    if($model-&gt;validate())
              {
                  $model-&gt;image-&gt;saveAs('/opt/lampp/htdocs/upl/images');
  
              Yii::app()-&gt;user-&gt;setFlash('success', 'File Uploaded');
              $this-&gt;redirect(array('upload'));
              }
  
  
          }
          $this-&gt;render('upload', array('form' =&gt; $form));
      }
  }
  
  ?&gt;
  </code></pre>