title: Fatal error: Call to undefined function site_url() in PHP
body: <p>I have a form that that has ACTION="upload.php". This file is present in the same directory as the form is in. Now what I want is to show a message when the form does the operation successfully navigate back to page that has the form. Something like this:
  This is the page where I upload the file.
  <img src="https://i.stack.imgur.com/qtbde.png" alt="enter image description here"></p>
  
  <p>Then on Upload button click, it goes to 'upload.php':</p>
  
  <pre><code>&lt;?php
  $this-&gt;load-&gt;helper('url');
  $site_path = site_url();
  $targetfolder = "doc_libraray/";     
   $targetfolder = $targetfolder . basename( $_FILES['file']['name']) ;    
  if(move_uploaded_file($_FILES['file']['tmp_name'], $targetfolder))   
  {
       echo "The file ". basename( $_FILES['file']['name']). " has been uploaded";
      return;
  }    
  else {   
   echo "Problem uploading file";  
  }?&gt;
  </code></pre>
  
  <p>The problem here is when I try to use siteURL() to redirect after upload success, it gives me a fatal error message. Not able to understand why? Any suggestions on how to achieve it?</p>
  
  <p><strong>OR</strong>
  Is there a way to process the uploaded file on the same page itself?</p>