I managed to find this script:
PHP Code:
if(isset($_GET['file']) && file_exists($_GET['file']))
{
header("Content-Type: application/octet-stream");
if (strstr($_SERVER['HTTP_USER_AGENT'], "MSIE 5.5"))
{
$attachment = "";
}
else
{
$attachment = "attachment;";
}
header("Content-Disposition: $attachment filename=\"$file\"");
header("Content-transfer-encoding: binary\n");
header("Content-length: " . filesize($_GET['file']) . "\n");
$fp = fopen($_GET['file'], "rb");
fpassthru($fp);
}
else
{
print('<span class="errors">Error: </span>');
print('You did not request a file, please make sure you followed a correct link.');
}
When you have already downlaoded the file and it's in your cache... it will just open in the window as an image
However if I run a pop-up, get the user to click the downlaod link from there the file opens in a prompt always.
It may in the end go through two files rather than one but that is fine
Thanks for the help.
__________________
If logic is of no use with out knowledge, what use am I? ~ Sk8rRIMuk
Last edited by Sk8rRIMuk; 11-28-2003 at 07:23 AM..
|