I need to copy "N" number of files from client to server with asp.net c #
I've done something like that, but it is useless because it takes only server addresses
Somebody help me .. Thanks ..!!!
private void btnUpload_Click(object sender, System.EventArgs e)
{
string fileName = "";
ArrayList List = new ArrayList();
string _directory = Request.Url.Segments[1].Substring(0,Request.Url.Segments[1].Length-1);
string TargetPathServer = "C:\\Inetpub\\wwwroot\\"+_carpeta+"\\Files\\Excell\\";
string [] filePaths = Directory.GetFiles( @"D:\DOCUMENTOS\SIRM\Archivos","*.xls" );
try
{
if(Directory.Exists(TargetPathServer))
{
Directory.Delete(TargetPathServer,true);
Directory.CreateDirectory(TargetPathServer);
}
else
Directory.CreateDirectory(TargetPathServer);
if (filePaths.Length > 0)
{
for (int i = 0; i <= filePaths.Length - 1; i++)
{
string TargetPathServerFile = "C:\\Inetpub\\wwwroot\\"+_directory +"\\Files\\Excell\\";
string TargetPathClient = filePaths[i];
FileInfo info = new FileInfo(filePaths[i]);
fileName = info.Name;
TargetPathServer = TargetPathServerFile + fileName;
File.Copy(TargetPathClient,TargetPathServer);
if (i == filePaths.Length - 1)
}
}
else
{
uscMensaje.Text = ConfigurationSettings.AppSettings["strErrorNoFiles"].ToString();
uscMensaje.DesplegarError();
}
}
catch (Exception ex)
{
uscMensaje.Text = ex.ToString();
uscMensaje.Desplegar();
}
}