php code to copy files from one internal server to another
Posted on 2012-08-20
I have a web page that displays a list of files that users may download from my network. (This is all intranet stuff so at least at this stage I'm not concerned with hacking, injections etc). I want to be able to let the user click on the file link and then have the server side code copy the file from the document server to the download area on the web server. The user doesn't need to know where the original document came from or what it's original file name is/was. I've gotten the code functional up to the point where I try to do the actual copy between the servers. I have ftp on the web server but NOT the document server. I just need to do the copy itself using some form of IO function(s) if possible. I've already got the code functional to the remote client end once I've gotten the file into the download area. I just can't get the file to copy from the document server to the download area.
In php, I've attempted to use copy, shell_exec() and exec(). copy just returns false, Shell_exec and exec return 0 files copied. Since I'm shelling out from the web server side, would I still have a rights issue that may be blocking the copy? If so, I'm not aware of where to read/learn about setting up security rights for this process and help would be appreciated.
I have also written a console executable and run it from the command prompt on the web server (hard coded the copy). It runs and completes normally. When I run exec("MoveDocument.exe"), nothing happens. No return value and nothing copies.
I'm running PHP 5.3.9 on Windows 2k8R2 IIS 7. I've also checked my configuratoin and php safe mode configuration is off.
I know just enough about PHP configurations and IIS configurations to be dangerous. So, if you are able to help, please be explicit enough in your responses to help me find the appropriate documentation pieces to learn about what your suggesting. In my world, I'm a general practitioner, not a specialist.
Thanx in advance for any thoughts.