Re: writing uploaded file to another drive on another network?

From: Date: Tue, 17 Dec 2002 15:03:50 +0000
Subject: Re: writing uploaded file to another drive on another network?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-128571@lists.php.net to get a copy of this message
No, it's not stupid - I don't know why you may need this but as long as you need it... Anyway. It would be interesting to know what OS you're using on both ends of the connection. If they're both *nix machines, it's rather simple. You typically copy the uploaded file from the temporary location to their final destination on upload. You might as well copy them to a remote location instead using system calls, such as scp. Setting up scp to not require command line authentication is done as follows: web_serv$ ssh-keygen -t rsa web_serv$ scp .ssh/id_rsa.pub remote_serv: remote_serv$ cd ~; mkdir .ssh remote_serv$ cat id_rsa.pub >> .ssh/authorized_keys2 remote_serv$ chmod -R go-rwx .ssh; rm id_rsa.pub web_serv$ ssh webserver (running as apache on both machines) This is the cleanest method I can think of. There are lots of in-between solutions, but I guess the last resort (ugliest) solution would be having an Apache server on the receivng end as well, and using whatever method to send the files via HTTP (Curl, home grown function to build a POST request or one of the zillions of similar libraries freely available). After all, you could even have the form on the web server directed to your local machine running Apache, and upon receiving the file you could perform a redirect via HTTP back to the web server. Just my 2c. Bogdan Kenn Murrah wrote:
admitting in advance that this may be a REALLY stupid question .. i've created a page for uploading files using PHP, and it works fine ... is it possible to write that uploaded file to another drive, on another network? for instance, my PHP pages are currently being hosted offsite ... would it be possible to direct the uploaded pages to a box that's located at the office? something like "192.168.100.41/home/mydirectory" ??? thanks, and feel free to laugh at my question :-)


« previous php.general (#128571) next »