jkies00 Posted September 5, 2006 Share Posted September 5, 2006 Hello,I've opened a directory, and I'm trying to read a text file, but I can't get it to read:[code]$subFolders = opendir($dir); $myfile = "info.txt";$fh = fopen($myFile, 'r');$theData = fread($fh, 5);fclose($fh);echo $theData;[/code]The directory I've opened does contain the info.txt file I'm looking for. I'm able to view it if I list the contents of the folder. Why can't I read it? The above code returns no output.~jeff Link to comment https://forums.phpfreaks.com/topic/19825-why-cant-i-read-this-file/ Share on other sites More sharing options...
Caesar Posted September 5, 2006 Share Posted September 5, 2006 Try:[code]<?php $myfile = file('info.txt'); print_r($myfile);?>[/code]See if you can get he contents of the array to output. Link to comment https://forums.phpfreaks.com/topic/19825-why-cant-i-read-this-file/#findComment-86792 Share on other sites More sharing options...
jkies00 Posted September 6, 2006 Author Share Posted September 6, 2006 Still nothing. Would it matter that my $dir variable is coming from an array?[code]$dir = $dirArray[0];$subFolders = opendir($dir); $myfile = file('info.txt');print_r($myfile);[/code] Link to comment https://forums.phpfreaks.com/topic/19825-why-cant-i-read-this-file/#findComment-86983 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.