I have a webpage(.aspx) which contains MULTIPLE FileUpload
controls.
Default.aspx
<asp:FileUpload ID="FileUploadPort" runat="server" CssClass="Upload" Multiple="Multiple"/>
<asp:FileUpload ID="FileUploadSearchImages" runat="server" CssClass="Upload" Multiple="Multiple"/>
Default.aspx.cs
protected void btnSubmit_Click(object sender, EventArgs e)
{
string filenm = string.Empty;
HttpFileCollection fileCollection = Request.Files;
for (int i = 0; i < fileCollection.Count; i++)
{
HttpPostedFile uploadfile = fileCollection[i];
if (uploadfile.ContentLength > 0)
{
string filename = uploadfile.FileName;
string imgFolder = ConfigurationManager.AppSettings["AdminSearchImgFolderPath"];
System.Drawing.Image image = System.Drawing.Image.FromStream(uploadfile.InputStream);
image.Save(imgFolder + "\\" + GetSearchImageFileName("TEST"), ImageFormat.Jpeg);
}
}
}
Here, Request.Files
will get collectively all files from both the FileUploadControls
.
I am NOT able to IDENTIFY which file(s) are from specific FileUpload control?
I know its possible in 4.5 but my current framework is 4.0 and i dont want to upgrade to 4.5. Any solution using existing 4.0 framework??
Help appreciated!
Please note: This is not DUPLICATE question as my requirement is to upload and identify the files of different fileupload controls on single page.