title: downloading a file from server in codeigniter
body: <p>I'm trying to download a file from my server.</p>
  
  <p>Here is my code for controller.</p>
  
  <pre><code>public function download($id)
  {
      $this-&gt;load-&gt;helper('url');
      $base_url = $this-&gt;config-&gt;item('base_url');
      $base_path = $this-&gt;config-&gt;item('base_path');
      $this-&gt;load-&gt;helper('download');
  
      $data = file_get_contents( $base_path.'/uploads/'.$id);
      $name = $id;
      force_download($name, $data);
  }
  </code></pre>
  
  <p>However, I'm getting an error:</p>
  
  <pre><code>file_get_contents(path/filename): failed to open stream: No such file or directory.
  </code></pre>
  
  <p>How can I solve this problem?Thank's</p>
  
  <p>the problem is in the path itself. actually its not taking filenames with space between them. for ex. it's working fine now with filename xyz but not with filename ex. try xyz. I think it's because of the space in between the name. how can i solve this problem?</p>