How to copy files from a client computer to a server using php.
Posted on 2011-03-08
I am about to start a project that allows the user to open a webpage (from a server in our LAN) to copy a file from his/her computer to another computer (or the server).
I would like to use html, php, apache, from a windows 2008 server and maybe js.
The idea is that the user would be able to get to the webpage from any place in the world via VPN, and upload a file to the target computer. But the uploading of the file should be "automatic"; that is, I should not have to go through the standard upload file procedure. The program will simply look in a pre-specified directory and ask which file to process it finds there. "processing" requires renaming the file as it is copied or moved.
The user will have the option of:
1) moving the file: which means the file must be copied (and renamed) then deleted from the client computer
2) copy the file: which means the file must be copied (and renamed) AND renamed on the client computer
3) copy and leave the file: the file must be copied (and renamed) the original file is left alone on the client computer
The question is....how can I do this? I am pretty sure that php will not let me do the remote file manipulation, so I am looking for a solution to do this.
I do not want to use any pre-installed client side programs to achieve this.
I know the names/ips of the client computers and their user login and pw (if that helps).
So, my crazy idea would be....
1) SOMEHOW the server would check the source directory from the client computer
2) the user would complete the options
3) the server would copy the files from client to the server. How? I was thinking the php will create a batch file that would then be executed via php file. It would be that batch file that would do the file manipulation.
Anybody have any other ideas? (I'm not looking for code....yet)