Question

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.

Was it helpful?

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)

OTHER TIPS

you have to map the drive first..

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

Hope this will helps you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top