Ökii
10-17-2002, 05:16 PM
Currently my download script gets the .php files to the client, just happens to rename them all to download.txt rather than script.php - is there a way round that?
current syntax basics
$fname = '/home/etc/devsys/downloads/'.$fname;
if(false!==$fp=@fopen($fname,"rb"))
{
$filedown=@fread($fp,filesize ($fname));
header("Content-Type: application/octet-stream");
header("Content-Length: ".filesize($fname));
header("Content-Disposition: attachment; filename=$fname");
header("Content-Transfer-Encoding: ascii");
echo $filedown;
}
which would be called as download.php?fname=myfile.php
I have tried content-type: application/force-download and text/plain as well - neither of which helped.
Anyone got any clever hints and tricks?
current syntax basics
$fname = '/home/etc/devsys/downloads/'.$fname;
if(false!==$fp=@fopen($fname,"rb"))
{
$filedown=@fread($fp,filesize ($fname));
header("Content-Type: application/octet-stream");
header("Content-Length: ".filesize($fname));
header("Content-Disposition: attachment; filename=$fname");
header("Content-Transfer-Encoding: ascii");
echo $filedown;
}
which would be called as download.php?fname=myfile.php
I have tried content-type: application/force-download and text/plain as well - neither of which helped.
Anyone got any clever hints and tricks?