Forum Moderators: coopster

Message Too Old, No Replies

accessing file from remote computer

unable to access file

         

sasip_hyd

10:06 am on Sep 29, 2007 (gmt 0)

10+ Year Member



I am unable to access a text file in a remote PC from my server.In my PHP5 .ini file, allow_url_fopen is "on" and allow_url_include is "off". The code used was

<?php
$filename="file:\\erp3\sasi.txt";
if (file_exists($filename)){
echo "Yes";}
else {
echo "No";}
?>
The output is "No". The file "sasi.txt" is in sharing mode in that PC.I am able to open it in my server PC through My Network Places in Windows XP. The address above is pasted from the address bar of My Network Places.

vincevincevince

10:10 am on Sep 29, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In my PHP5 .ini file, allow_url_fopen is "on" and allow_url_include is "off".

I'm afraid that url_fopen does not apply to file:\\ (or file:///) paths. You need to use a local web-server on that PC and then access it by http: //192.168.?.?/erp3/sasi.txt

sasip_hyd

8:18 am on Oct 1, 2007 (gmt 0)

10+ Year Member



Thank you vincevincevince

But does that mean that it is impossible to read a file from a remote computer in the network in the normal way (other than through http and ftp)in PHP?

phranque

8:50 am on Oct 1, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, sasip_hyd!

the file: protocol works in some browsers to access local or network attached files.

the file_exists function takes a file path argument (not a url) which may specify the computer in the path name for network shared files on windows.