OK here is my solution. i've taken a more simplistic approach.
I have added this to admin/orders.php:
HTML Code:
<div style="width:400px; padding-bottom:20px;">
<h3>Order Image Downloads</h3>
<form target="_blank" action="download.php" method="post">
Enter the image file name, for example <strong>2.jpg</strong> if the uploaded files shows as <strong>2. Myimage.jpg</strong> on the product option line. Then click submit to download.
<br />
<input type="text" name="fname" />
<input type="Submit" name="Submit">
</form>
</div>
and then uploaded a file called download.php to the admin directory with this code:
PHP Code:
<?php
$number = $_POST["fname"];
$file = '/home/yourpath/public_html/images/uploads/' . $number;
if (file_exists($file)) {
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($file));
ob_clean();
flush();
readfile($file);
exit;
}
?>
Hope this helps anyone else with the same requirements and if anyone spots any mistake or potential problems doing it in this way please let me know :)
Bookmarks