How to open a file using PHP

Post Reply
Tony
Lieutenant
Lieutenant
Posts: 86
Joined: Tue Jul 21, 2009 4:11 pm

How to open a file using PHP

Post by Tony » Sun Nov 29, 2009 3:15 am

Code: Select all

<? 
$filename = "delete.htm"; // This is at root of the file using this script.
$fd = fopen ($filename, "r"); // opening the file in read mode
$contents = fread ($fd, filesize($filename)); // reading the content of the file
fclose ($fd);               // Closing the file pointer
echo $contents;              // printing the file content of the file
?>
Post Reply

Return to “PHP & MySQL”