hey guy, i need some help in reading a file across my network...

this is what i did...

$myFile = fopen("\\\backup\Gatepass\Gate_Pass.csv",'r') or die("cannot connect");
   $rows = file("$myFile")or die("cannot connect");

but each time i'm getting an error : failed to open stream: No such file or directory

can someone help me

5 Years
Discussion Span
Last Post by code739

thanks for the quick response....hmm...the thing is this file is in another pc, the odd thing is, when i paste the path in my browser, i was able to access and download the file...but when i put the same path in my php...its not working...

Edited by gopi17


Try to put b or t flags for example

$myFile = fopen($file,'rt') or die("cannot connect");
 $myFile = fopen($file,'rb') or die("cannot connect");

Windows offers a text-mode translation flag ('t') which will transparently translate \n to \r\n when working with the file. In contrast, you can also use 'b' to force binary mode, which will not translate your data. To use these flags, specify either 'b' or 't' as the last character of the mode parameter.


still getting the same error Mr.code739...

$myFile =fopen($file,'rb');
if (file_exists($myFile)) {
echo "working";

sorry for the incomplete reply: =)
yeah broj is right. check first if allow_url_fopen is set into true
then in $file variable have the url


you can have

if it's not working can i ask where this scipt recides in is it resides and the backup folder or its directory structure
is like this //10/102.216.129/yourscript.php ?

if it is then you can have this url "backup/Gatepass/Gate_Pass.csv" to make your codes dynamic

Edited by code739

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.