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

08-27-2007, 12: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");
but it didnt open . can anybody help to open that file.

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