...

View Full Version : how can i open .txt file using header in php



venkib097
08-27-2007, 01:18 PM
i have a link ,whenever i click it will automatically open that file.the file path is saved at $file variable mensioned below.how can i open .txt file using header in php.i tried like
<?
$filename = "C:\Documents and Settings\Administrator\Desktop\Hourly Reports\ 237.txt";
$disp ="content-disposition: attachment;filename='$filename'";
header('Content-type: text/plain');
header("Expires: 3");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header($disp);
?>
but it didnt open . can anybody help to open that file.

Mwnciau
08-27-2007, 04:30 PM
Try putting readfile($filename); at the end.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum