简体   繁体   中英

accessing c drive of a network computer using php

I am trying to access C drive of a network PC. I am able to access it using explorer writing this path \\\\PCNAME\\c$\\path\\to\\file . But when I tried accessing it using copy function of php its not working. Here is my php code.

copy("\\\\PCNAME\\c\$\\path\\to\\file","filename");

Is there any syntax error?
Kindly help me with this.

It's not

copy("\\PCNAME\c\$\path\to\file","filename");

It's

copy('\\PCNAME\c$\path\to\file',"filename");

Notice the c$ (hidden share), but why not create a publicly accessible share?

Edit: Also notice the single quotes, this is in order to preserve the backslashes (you were right @Esailija)

you have to map the drive first..

then pass proper drive location to copy the file.. for eg your mapped drive is g:\\Program Files\\file_name then pass that location to copy() function

Hope this will helps you.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM