title: Problem with saving attached files using FileUpload control in ASP.NET
body: <p>In my website,I have a home page in which by clicking on an image button,I get redirected to a different .apsx page .This page consists of a FileUpload control and 2 buttons(ATTACH,CANCEL).When a user selects/browses a file from his local machine and click ATTACH button,I display that file in a GRIDVIEW and also push the details of that file like Filename into a DATATABLE.</p>
  
  <p>The user in this way can browse multiple files and all of them are added to GridView and also pushed to DATATABLE.Now when the user clickes CANCEL button,I am sending the whole DATATABLE in a session object to the HOME page.Upon clicking SAVE button in the home page,the files in the DATATABLE must get stored in a physical location that I mention in the code.</p>
  
  <p>The problem that I am facing is that when I write 
  FileUpload fl=new FileUpload;</p>
  
  <p>fl.SaveAs(dt["fileName"]);</p>
  
  <p>The files are not at all getting saved in the location.</p>
  
  <p>However If I pass the FileUpload control using Session from the second page,</p>
  
  <p>FileUpload fl=(FileUpload)Session["FileUpload"]</p>
  
  <p>The files are getting saved with the correct filenames but the content of all the files consists of the content of the latest uploaded file.I know what the problem is but unable to get a solution.</p>
  
  <p>My Requirement is to save the files in a physical path only after clicking the Save button in the home page.Kindly Suggest me..Thanks in advance!</p>