file download problem
Posted: Thu Feb 20, 2003 2:29 pm
I have this ocde and it doesn't work as expected. I would like the user to be propmted to download a file named. test.txt with the content from $document. Can anyone shed some light on why this wont work?
Here is a link to the code.
http://www.mana-ts.com/dl_test.php
Keith
Code: Select all
<?php
$document = "This is what I want in the file\n\nLine 3";
$length = strlen($document);
$filename = "text.txt";
header("Content-Type: application/octet-stream");
header("Content-Length: " . $length);
header("Content-Disposition: inline; filename=" . $filename);
return($document);
?>http://www.mana-ts.com/dl_test.php
Keith