Search code examples
phpsqlitedrive

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.


Solution

  • 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)