svanlund
asked on
Name of downloaded file
Hi!
I have the following script on a site (dl.php):
$size = filesize("/home/b2048/doku ment/" . $dok);
header("Content-Type: application/octet-stream") ;
header("Content-Length: $size");
header("Content-Dispositio n: inline; filename=$name");
header("Content-Transfer-E ncoding: binary");
$fh = fopen("/home/b2048/dokumen t/" . $dok, "r");
fpassthru($fh);
exit;
It gets the specified file from a folder outside the www-root. When the Save as dialog box pop ups in IE it wants to save the document as dl.php. I want it to save it as the original filename (example: document.doc) without me editing it in the save as dialog. Is it possible to make PHP pass the filename in some way so it doesn't say dl.php?
Thanks!
/David
I have the following script on a site (dl.php):
$size = filesize("/home/b2048/doku
header("Content-Type: application/octet-stream")
header("Content-Length: $size");
header("Content-Dispositio
header("Content-Transfer-E
$fh = fopen("/home/b2048/dokumen
fpassthru($fh);
exit;
It gets the specified file from a folder outside the www-root. When the Save as dialog box pop ups in IE it wants to save the document as dl.php. I want it to save it as the original filename (example: document.doc) without me editing it in the save as dialog. Is it possible to make PHP pass the filename in some way so it doesn't say dl.php?
Thanks!
/David
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I changed the variable to $dok instead of $name.
The points are yours :-)
/david