Image download - image cannot open
<p>I tried to create some code so that a user can download an image in opencart without right clicking and using <code>Save as...</code> but after I created this code and download the image, trying to open the image says the image was damage.</p>

<pre><code>&lt;form action="download.php" method="post" &gt;
&lt;input type="text" name="file" value="&lt;?php echo $image['popup']; ?&gt;" /&gt;
&lt;input type="submit" value="download" /&gt;
&lt;/form&gt;
</code></pre>

<hr>

<p>download.php</p>

<pre><code>&lt;?php
$file= $_POST["file"];

header ("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header ("Content-Type: application/octet-stream");
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-type: application/pdf');
header('Content-type: image/jpg');
header('Content-type: image/gif');
header('Content-type: image/png');

readfile('$file');

?&gt;
</code></pre>
