PHP access to LAN shared files

Source: Internet
Author: User
Tags ldap
Hello, everyone! I want to access the image file on another computer in the LAN, but I can't find it in PHP. In PHP with filesize test the size of the picture is not! The code is:
$filename = "Http://172.16.18.123/pic/2012.png";
$size = FileSize ($filename);
Echo $size;

The reported error is: Warning:filesize () [Function.filesize]: Stat failed for http://172.16.12.103 ...
I'm sure two machines are in a network segment, and the share is set. I can enter the URL address in the above code in the browser.
Ask who has dealt with this problem of heroes! Not very grateful!!


Reply to discussion (solution)

$filename = "//172.16.18.123/pic/2012.png";

$filename = "//172.16.18.123/pic/2012.png";
Thank you very much!! I tried, right! But I found a problem if I wrote
$filename = "//172.16.18.123/news/pic/2012.png"; it is still not found. Both the News folder and the Pic folder are shared, but news is the previous level of pic. What's going on here? Please help me to answer the question is not very grateful! Also, if I put 2012.png directly into the 172.16.18.123 of the F-packing directory, the code should be how to write ah??? Thank you, this warrior! I am really a rookie, sorry!!!

Unified resource Positioning
Machine name or ip/share name/path/file name

I learned another trick today.

Unified resource Positioning
Machine name or ip/share name/path/file name
Thank you for this hero, I'm sorry to trouble you next ~ ~ ~ This case, if you want to ensure the security of remote files should be how to do? Read the manual said to open Safe Mode, PHP will check the script and the file to be read UID, what is the specific meaning ah? How is the UID checked? There is no further information to recommend AH ~ ~ ~ OR, php.ini inside can be a remote file login permissions to do a set AH? For example, set its user name and password so that the remote file can be opened by validating it. Thank you!! Extremely grateful!! Look forward to your reply Oh!!!

When no protocol is declared, the default protocol name is file only for LAN

If you need a security check, you cannot use the same resource to locate it. You need to use LDAP

This post was last edited by xuzuning on 2012-12-18 11:27:22 When you edit a non-protocol declaration, the default protocol name is file only for LAN

If security checks are required, you cannot locate the same resource. Need to use LDAP
Thank you!! I just want to make a simple call to a file on another machine in the LAN, but the unified resource can not be used for security checks, that is, the user logon rights can not be verified. In this case, if I map the folder of the target machine to a local disk, can this be done? In my code this writes $pic= "z:\\data\news\pic\1.jpg"; Z is another folder on that machine mapped to the drive letter of the machine, this way, PHP does not seem to know, is not I write wrong? Ask you!! In short I want to simply call a thing, but do not want to put the folder on that machine completely exposed, is a little safer, please help answer!! Thank you so much!!!

": Connect the computer or disconnect the computer from the shared resource, or display connection information for the computer.
Command format: NET Use(devicename | *)(computernamesharename(volume))(password | *))(/user:(domainname)username)((/delete )| (/persistent:{yes | no}))
Parameter Description:
Type net use without parameters to list network connections. The
devicename Specifies the name of the resource to connect to or the name of the device to disconnect.
The name of the Computernamesharename server and shared resource.
Password access the password for the shared resource.
* Prompt to type a password. The
/user Specifies another user to connect to. The
domainname specifies another domain. The
username Specifies the user name for the login.
/Home connects the user to its host directory. The
/delete cancels the specified network connection. The
/persistent controls the use of persistent network connections.
Simple case:
(1) net use E:yfangtemp to set up the Yfangtemp directory as e-disk
(2) net with E:yfangtemp/delete disconnect

NET use
Role: Connect the computer or disconnect the computer from the shared resource, or display the connection information for the computer.
Command format: NET Use(devicename | *)(computernamesharename(volume))(password | *))(/user:(domainname)username)((/delete)| (/persistent:{yes |
Warrior, I have tried according to you, the 172.16.22.10 on the F-map to my native Z-disk, I lost in the command line: net use Z: \\172.16.22.10\f$ "password"/user: "Administrator", I tried to do that. But I do not have to use the system function in PHP, please help me to see, My code is:

$cmd = "net use Z: \\\\172.16.22.10\\f$ \" password\ "/user:\" administrator\ "";
if (System ($CMD))
echo "Mapping Success";
else echo "Mapping failed";

Please help me to see is the problem of the code, or php.ini inside need to configure what things to do ah, my security mode is off.

Thank you!!! Thank you very much for not being bothered to answer me a rookie weak weak problem ...!! Look forward to your reply Oh!! ~~~

Character \ In turn, it's much clearer.
$cmd = "net use Z://172.16.22.10/f$ password/user:administrator";
and password is Administrator's login password, to the real

Character \ In turn, it's much clearer.
$cmd = "net use Z://172.16.22.10/f$ password/user:administrator";
and password is Administrator's login password, to the real
Thank you, Hero!! I follow your words to write, but still no no AI ~ ~ ~ Please help me to see:
$cmd = "net use Z://172.16.22.10/f$ pass123456/user:username";
System ($CMD);
You see the system function is not the problem ah, need to modify in the configuration file what is not?
I can do it on the command line, but PHP can't do it.
Thank you again!! ~~~~~~~~~~~

I ask the landlord finally this problem solved it now I also met the same problem, looked up a lot of information also did not solve. Ask for help.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.