Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

file_exists not working for network path

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

file_exists not working for network path

Postby viveks485 » Wed May 29, 2013 5:51 am

Hi Experts,
I am simply using a check to know whether a file exists or not on a network path but that is always returning
false.
Simple code is as following :
<?php

$path = "\\\\fcmatrix\\matrix\\matrix\\repos-prod\\storage\\crashreport\\minidump_processor\\builds\\217864\\artifacts\\b85a42fe-c76f-4945-8fb7-415bdb25bc36.xml";
if(file_exists($path))
echo "present";
else
echo "absent";
?>


it is returning absent everytime. I can acccess this folder from Run on that machine where PHP and Apache is setup and script is running.
I dont whats wrong here.
Please help me to resolve this issue.
Thanks and Regards,
Vivek
viveks485
New php-forum User
New php-forum User
 
Posts: 3
Joined: Wed May 29, 2013 5:46 am

Re: file_exists not working for network path

Postby viveks485 » Wed May 29, 2013 6:20 am

I know it could be a simple question for most of you but I am stuck at it and can't go ahead without solution so please suggest what is wrong and how can I fix this.
Vivek
viveks485
New php-forum User
New php-forum User
 
Posts: 3
Joined: Wed May 29, 2013 5:46 am

Re: file_exists not working for network path

Postby johnj » Wed May 29, 2013 8:48 pm

before fcmatrix why are you using four backslashes? use two. Also, display the path and make sure it is correct before you use this path in file_exists().
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: file_exists not working for network path

Postby johnj » Wed May 29, 2013 8:51 pm

Another point - try to match directory by directory. e.g. first use file_exists() and check if \\fcmatrix is getting matched, then try \\fcmatrix\matrix and so on. This way, you will know what is not getting matched.
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm

Re: file_exists not working for network path

Postby viveks485 » Thu May 30, 2013 6:05 am

Thanks for the reply.
Nothing is being matched starting from \\fcmatrix :(
viveks485
New php-forum User
New php-forum User
 
Posts: 3
Joined: Wed May 29, 2013 5:46 am

Re: file_exists not working for network path

Postby johnj » Thu May 30, 2013 6:14 am

are you sure fcmatrix exists and you have the required permission to access it?
johnj
php-forum Super User
php-forum Super User
 
Posts: 1805
Joined: Thu Mar 10, 2011 5:07 pm


Return to PHP coding => General

Who is online

Users browsing this forum: No registered users and 3 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.