Re: Problem with file reading

This is a discussion on Re: Problem with file reading within the PHP General forums, part of the PHP Programming Forums category; ===ORIGINAL=== Hi, I'm a beginner and i'm still learning PHP and I got a problem: $file = "http://...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-05-2007
Fahad Pervaiz
 
Posts: n/a
Default Re: Problem with file reading

===ORIGINAL===
Hi,

I'm a beginner and i'm still learning PHP and I got a problem:




$file = "http://localhost/test_folder/test1.txt";<http://localhost/test_folder/test1.txt>//I
have also
tried "test_folder/test1.txt" and "text1.txt"


$fh = fopen($file, "r") or die("Could not open file!");


$data = fread($fh, filesize($file)) or die ("Could not read file!");


fclose($fh);


echo $data;


The file exist, I'm using apache server on my PC for practicing and the
file is located in the servers root folder on the subfolder "test_folder".

Help would be greatly appreaciated

Thanks in advance!
===END ORIGINAL===

Try using the complete path in $file... you can get the complete path by
using
$_SERVER['DOCUMENT_ROOT']

Also be sure that path given in $file variable is relatvie to location
of php file that is executing


--
Regards
Fahad Pervaiz
www.ecommerce-xperts.com
(Shopping Cart, Web Design, SEO)

Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 08:57 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0