Topic: Upload through one server to another

I want to allow users to upload files(zipped EPS files) to my site that will be downloaded by other users.

The catch is I have rails running on a mongrel cluster on Slicehost, but I want the files to be stored on bluehost (shared environment).

The reason for this is b/c bandwidth and storage space is much cheaper on bluehost so I'd like the users to be able to download the files via a link to the bluehost server.

Anyone have any ideas or am I just going to be forced to pay the higher bandwidth and storage costs?

Thanks,
Seth

Re: Upload through one server to another

You could try sending files from Slicehost to Bluehost through FTP.
http://ruby-doc.org/core/classes/Net/FTP.html



You could try a convoluted approach in an attempt to avoid file transfers between servers. Direct the user to upload the file at Bluehost and redirect back to Slicehost when the upload is complete. However, you'll need to handle authentication.

1) generate a time limited auth token string when user accesses upload form at Slicehost
   - save auth token to DB
   - include auth token inside a hidden field in your upload form
2) point the upload form's destination url to Bluehost
3) simple script at Bluehost discards file upload if a query to Slicehost says auth token is invalid
4) redirect user back to Slicehost

Vincent Woo Ruby on Rails Blog

Re: Upload through one server to another

thanks, I'm going to try to use the FTP approach.