title: Use Multiple File Upload Control using C#
body: <p>I have two FileUpload on a single Web Page.
  The problem is that when I uploaded the file using FileUpload3 on specific folder it also upload the FileUpload2 file also on that folder.
  I want that when i click on Submit Button FileUpload3 upload file on specfic folder of only FileUpload3 not FileUpload2.
  I am using ASP.Net and C#.</p>
  
  <p>My ASPX Code :</p>
  
  <pre><code>&lt;asp:FileUpload ID="FileUpload2" runat="server" /&gt;&lt;/br&gt;
  &lt;asp:FileUpload ID="FileUpload3" runat="server" AllowMultiple="true" /&gt;
  </code></pre>
  
  <p>and My C# Code :</p>
  
  <pre><code>if (FileUpload2.HasFile)
              {
                  string time1 = INDIAN_ZONE.ToString("MM-dd-yyyy_hhmmss");
                  string directoryPath = Server.MapPath(string.Format("./Upload_Files/Day_Description/Destination_Image/" + DropDownList8.SelectedItem.Text + "/" + Label23.Text));
                  if (!Directory.Exists(directoryPath))
                  {
                      Directory.CreateDirectory(directoryPath);
                  }
                  else
                  {
                  }
  
                  string fileName = Path.GetFileName(FileUpload2.PostedFile.FileName);
                  fileName = time1 + fileName;
                  string path = "./Upload_Files/Day_Description/Destination_Image/" + DropDownList8.SelectedItem.Text + "/" + Label23.Text + "/";
                  FileUpload2.PostedFile.SaveAs(Server.MapPath(path) + fileName);
              }
              else
              {
                  string time1 = INDIAN_ZONE.ToString("MM-dd-yyyy_hhmmss");
                  string directoryPath = Server.MapPath(string.Format("./Upload_files/Day_Description/" + DropDownList8.SelectedItem.Text + "/" + Label23.Text));
                  if (!Directory.Exists(directoryPath))
                  {
                      Directory.CreateDirectory(directoryPath);
                  }
                  else
                  {
                  }
              }
  
              if (FileUpload3.HasFile)
              {
                  HttpFileCollection hfc = Request.Files;
                  for (int i = 0; i &lt; hfc.Count; i++)
                  {
                      HttpPostedFile hpf = hfc[i];
                      if (hpf.ContentLength &gt; 0)
                      {
                          string FileExtention = System.IO.Path.GetExtension(FileUpload3.FileName);
                          string time1 = INDIAN_ZONE.ToString("MM-dd-yyyy_hhmmss");
                          string directoryPath = Server.MapPath(string.Format("./Upload_Files/Day_Description/Hotel_Image/" + DropDownList8.SelectedItem.Text + "/" + Label23.Text));
                          if (!Directory.Exists(directoryPath))
                          {
                              Directory.CreateDirectory(directoryPath);
                          }
                          else
                          {
                          }
  
                          string fileName = Path.GetFileName(hpf.FileName);
                          fileName = time1 + fileName;
                          string path = "./Upload_Files/Day_Description/Hotel_Image/" + DropDownList8.SelectedItem.Text + "/" + Label23.Text + "/";
                          hpf.SaveAs(Server.MapPath(path) + fileName);
                      }
                  }
              }
              else
              {
                  string time1 = INDIAN_ZONE.ToString("MM-dd-yyyy_hhmmss");
                  string directoryPath = Server.MapPath(string.Format("./Upload_Files/Day_Description/Hotel_Image/" + DropDownList8.SelectedItem.Text));
                  if (!Directory.Exists(directoryPath))
                  {
                      Directory.CreateDirectory(directoryPath);
                  }
                  else
                  {
                  }
              }
  </code></pre>
  
  <p>The problem is that when I uploaded the file using FileUpload3 on specific folder it also upload the FileUpload2 file also on that folder.
  I want that when i click on Submit Button FileUpload3 upload file on specfic folder of only FileUpload3 not FileUpload2.
  I am using ASP.Net and C#.</p>