title: Download a image file in php
body: <p>I have a code , it works, i saved it with download.php , but i don't know, how to download the image file named simpletext.jpg present on the same root of the above mentioned file, I will be very thankful to you if you write the actual path, how to do that, the code is below....</p>
  
  <pre><code>$file_name = "a.txt";
  
  // extracting the extension:
  $ext = substr($file_name, strpos($file_name,'.')+1);
  
  header('Content-disposition: attachment; filename='.$file_name);
  
  if(strtolower($ext) == "txt")
  {
      header('Content-type: text/plain'); // works for txt only
  }
  else
  {
      header('Content-type: application/'.$ext); // works for all extensions 
  except txt
  }
  readfile($decrypted_file_path);
  </code></pre>