1

I need to move files through windows shares by php pages.

In a linux context I will use samba client to mount the share to a local path, however i can not understand how to do this in a windows webserver.

The webserver is running as "SYSTEM" user and I can not specify a valid share user.

1 Answer 1

1

In Windows, just use the following synthax in the php command "copy":

copy("\\server_source\path", "\\server_dest\path");

You need permissions to copy files (check the configuration of the webserver you're using, the user who's running the webserver must be included with r/w permissions).

If you haven't permissions, run a

system("net use drive1: \\server_source\path password /USER:[email protected]");
system("net use drive2: \\server_dest\path password /USER:[email protected]");

then:

copy("drive1:\path", "drive2:\path");

You must know which drive letter from Z: down to E: are available on your server.

8
  • Is "net use" global for all account and also for webserver?
    – Tobia
    Jan 18, 2013 at 10:01
  • This don't work, I can access drive1:\\ and driver2:\\ but copy fails.
    – Tobia
    Jan 18, 2013 at 10:06
  • Which version of Windows you're using?
    – AndrewQ
    Jan 18, 2013 at 10:10
  • Windows Server2012
    – Tobia
    Jan 18, 2013 at 10:25
  • Can you post the exact error?
    – AndrewQ
    Jan 18, 2013 at 10:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .