Page 1 of 1

[SOLVED] accessing files across local servers

Posted: Wed Jun 23, 2004 3:35 pm
by skylark
where "theserver" is a machine other than the one running PHP (under an apache install on a windows box), but accessible through the local network (it is visible, for instance, under the "microsoft windows network" in explorer), an image link of the form:

Code: Select all

<img src = "\\theserver/adirectory/imagefile.jpg">


properly loads the image into the browser.

and yet i can get no command to actually access that file and manipulate it. for instance,

Code: Select all

<?php
$fs = fopen("\\\theserver/adirectory/imagefile.jpg","r"); 
?>
returns either an invalid argument error or the error:

Code: Select all

php_network_getaddresses: gethostbyname


oddly enough, which error comes back seems not to be entirely consistent.

any thoughts?

Posted: Wed Jun 23, 2004 4:12 pm
by redmonkey
Have you tried....

Code: Select all

<?php
$fs = fopen("//theserver/adirectory/imagefile.jpg","r");
?>
You could also try specifying the remote machine by IP.

Posted: Fri Jun 25, 2004 9:25 am
by skylark
i have tried both of those options, and neither works.

Posted: Fri Jun 25, 2004 3:45 pm
by skylark

Code: Select all

<?php
$fs = fopen("\\\\server\\directory\\file.ext","rb");
?>
i got this to work. everything had to be backslashes for the path to read correctly, and it takes *4* backslashes to render a correct doubleslash. i could swear i'd tried this before, but it seems to work now. i have reason to believe that actually logging in to the machine and getting it to see the other server's path through the windows network may have broken the logjam.