ASP.NET - Uploading file in multiple severs - Asked By jeccinta jeccinta on 01-Feb-10 09:14 AM

Hi,

Am currently uploading file in a single server.I want to know how to upload the same file in multiple servers.

Can someone help me in doing this?

Waiting for reply.

Thanks in advance.


F Cali replied to jeccinta jeccinta on 01-Feb-10 09:33 AM

One way to save the same uploaded file to multiple servers is to loop through the different servers you want to save the file and just call the SaveAs method of the FileUpload control.  Here's a sample code, which assumes you have an array of server locations:

for (int i=0; i < servers.Length; i++) {

    FileUpload1.SaveAs(servers[i] + fileName);

}

Regards,
http://www.sql-server-helper.com/error-messages/msg-547-update.aspx

I think you need a single file system - [)ia6l0 iii replied to jeccinta jeccinta on 01-Feb-10 09:54 AM

Are you sure you want to do this: You would not have permissions when it goes cross-domain and the other usual problems. 

and what is the whole deal of consuming disk space on multiple servers by uploading the same file. 

You would ideally need to store them in a single File Server and access it from your web servers (load balanced per se).

Please explain if i got it otherwise.
Sreekumar P replied to jeccinta jeccinta on 02-Feb-10 12:12 AM
it's better for  u to use the ftp services,
Huggy Bear replied to jeccinta jeccinta on 02-Feb-10 12:39 AM
Below steps would give you a good idea

1. Keep uploading the file to a single server.
2. Create a FTP job and deploy it in the web server, where the files would be uploaded.
3. For creating an FTP job use .net windows service or a simple exe which has to be scheduled using windows task scheduler to run after a particular interval.
4. FTP job should keep polling the upload directory for files.
5. If any file is found, do an FTP send to a list of servers which you can maintain in your config file.

For information about performing FTP job in .net go http://www.csharptalk.com/2010/01/how-to-download-file-from-ftp-server-in.html.