I want to check if files exists in the network folder (eg. path = "U:\\abc\\def\\") using php.
I tried to use following:
if(file_exists("U:/abc/def/400abc.doc")) {
echo "YES";
} else {
echo "NO";
}
I get NO. I also tried path = "//abc-drive/folder-main/abc/def/400abc.doc" but still it doesn't work.
The files are on a network/shared folder and NOT in subfolders from where php server runs
Can anyone please tell HELP?
Regards
This won't work if PHP has safe_mode enabled. Try setting safe_mode_include_dir
to add an exception, and reference the location with the syntax \\\\computername\\share\\filename
.
Use the URI format. file://U:/abc/def/400abc.doc
Change FASTCGI Setting in server [FASTCGI Setting] -> open ...php-cgi.ex -> FastCGI Property -> Advanced Setting -> protocol -> Change [NamedPipe] to [TCP]. I have same error with you, I tried it and success. GoodLuck
If file_exists is returning false for a file or folder on a Windows network drive, try the following:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.