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

this is what i did...

$myFile = fopen("\\10.102.216.129\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

Recommended Answers

All 6 Replies

I think the slash you are using matters try to change it to /
or
then try to coppy the whole link example http://10.102.216.129/backup/Gatepass/Gate_Pass.csv
If this file (where you wrote this script) has the same mother directory with the "backup" forlder just write /backup/Gatepass/Gate_Pass.csv

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...

Try to put b or t flags for example

$myFile = fopen($file,'rt') or die("cannot connect");
or
 $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...

$file="\\10.102.216.129\backup\Gatepass\Gate_Pass.csv";
$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
instead

\10.102.216.129\backup\Gatepass\Gate_Pass.csv

you can have http://10.102.216.129/backup/Gatepass/Gate_Pass.csv

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.