title: How to upload file into server using smarty?
body: <p>I've written code for upload file to server like below.</p>
  
  <p>Home.tpl</p>
  
  <pre><code>     &lt;form enctype="multipart/form-data" method="post" action="upload_file.php"  &gt;
       &lt;label for="file"&gt;Filename:&lt;/label&gt;&amp;nbsp;&amp;nbsp;
       &lt;input type="file" name="file" id="file"&gt;&lt;br&gt;
  </code></pre>
  
  <p>upload_file.php</p>
  
  <pre><code>     if(($_FILES["file"]["size"] &gt; 0))
       {
        $fileName = $_FILES["file"]["name"];//the files name takes from the HTML form
        $fileTmpLoc = $_FILES["file"]["tmp_name"];//file in the PHP tmp folder
        $fileType = $_FILES["file"]["type"];//the type of file 
        $fileSize = $_FILES["file"]["size"];//file size in bytes
        $fileErrorMsg = $_FILES["file"]["error"];//0 for false and 1 for true
        $target_path = "uploads/" . basename( $_FILES["file"]["name"]); 
  
        $moveResult = move_uploaded_file($fileTmpLoc, $target_path);
       }
  </code></pre>
  
  <p>But i getting 'Undefined index: file' error. please help me to get rid from there.</p>