开发者

php - check if files exists in folder on network/lan

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:

  1. Run regedit.exe
  2. Locate the following key - HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\RestrictNullSessAccess
  3. Change its value from 1 to 0.
  4. Restart your computer.
  5. Double check your network drive is connected.
  6. Retry your script - this time file_exists should return true.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜