title: Force download dialog for an image with PHP
body: <p>I have in my <code>index.php</code> a link like this:</p>
  
  <pre><code>&lt;a href="download.php?url=http://example.com/image.jpg"&gt;Download&lt;/a&gt;
  </code></pre>
  
  <p>I need that when you click that link the download dialong opens to save the foto with a specific name like <code>myfile123.jpg</code>.</p>
  
  <p>In my <code>download.php</code> I have this:</p>
  
  <pre><code>header('Content-type:image/jpeg');
  
  $handle = fopen($_GET['url'], "rb");
  while (!feof($handle)) {
    echo fread($handle, 8192);
  }
  fclose($handle);
  </code></pre>
  
  <p>And while it retrieves the image, it just opens it in the same tab (instead of forcing the dialog).</p>