0

Hi...
I want to find out whether a file is existing or not
The file is stored on another machine in the same network .
I tried the following code.But always showing "The file is not existing".

<?php $filename = 'file://192.168.0.15/E:/PDF/p.pdf';

if (file_exists($filename))
 {
   echo "The file $filename exists";
} else
 {
   echo "The file $filename does not exist";
}
?>

Does anyone know how to do this?

Edited by divyakrishnan: n/a

3
Contributors
4
Replies
5
Views
6 Years
Discussion Span
Last Post by sDJh
0

Hi divyakrishnan,

for me it seems as if you're using Windows. Simply try

$file='\\\\\\\\HOSTNAME\\file.txt';

. As I'm mainly using Unix, I don't know exactly how the address-structure looks like in a Windows-Domain. But as long as you mask you slashes correctly, it should work perfectly when you use the address given by the explorer.

Keep in mind that this does only work, when the server let's you out of the sandbox. In real-server-mode you do get trouble. You can then install an other webserver and access the data via

$file='http://iii.iii.iii.iii/filename';

. For me that's a much cleaner solution.

Hope that helps, Simon.

0

I am using windows.Tried

$filename ='\\\\\\\\192.168.0.15\\E:\\PDF\\p.pdf';

still not working.

1

the path for windows looks like
file://///hostname/Folder/...
where Folder is the name of the folder that is shared

Votes + Comments
simply true
0

Hi divyakrishnan,

you CANNOT access the complete filesystem of a remote computer! If that were possible, it'd cause a mess in security policies!

fikreyes is completely right. Have a look at basic Windows networking before trying to programme such things.

Greetings, Simon

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.