Hello,
I have a php script that allows users to download files they selected
earlier in the session.
I use the following code snippet to do this:
## set up headers
header("Content-type: application/x-gzip");
header("Content-disposition: filename: $filename");
header("Filenam e: $filename");
header("Content-length: ".filesize("pri vate/$filename"));
## now send the contents
@readfile("priv ate/$filename");
The problem is that the downloaded file gets named as this php code's
file name, and not the actual file name. I mean, if the php code is
in a file named process.php and the file the users download is
myfile.zip, the browser chooses to save the file as process.php.gz.
Any suggestions to fix this?
I have a php script that allows users to download files they selected
earlier in the session.
I use the following code snippet to do this:
## set up headers
header("Content-type: application/x-gzip");
header("Content-disposition: filename: $filename");
header("Filenam e: $filename");
header("Content-length: ".filesize("pri vate/$filename"));
## now send the contents
@readfile("priv ate/$filename");
The problem is that the downloaded file gets named as this php code's
file name, and not the actual file name. I mean, if the php code is
in a file named process.php and the file the users download is
myfile.zip, the browser chooses to save the file as process.php.gz.
Any suggestions to fix this?
Comment