locked
Can I force a FileUpload control to retain a file in its browser field after a postback? RRS feed

  • Question

  • User695372294 posted

    I have a bunch of FileUpload controls on one of my ASP.NET 3.5 web pages. They are contained within an UpdatePanel but there are PostBackTrigger settings to enable the FileUpload controls to work properly. Each FileUpload control contains a Browse button that lets the user find the file to be uploaded. Each FileUpload control is also associated with an Upload button that uploads the selected file to the webserver. This all works fine but one of the quirks of this design is that you must upload each file as soon as it has been found via a Browse button.

    If, instead, you load the browser in one FileUpload control and then click another Browse button before the first file is uploaded then the browser in the first FileUpload control will be cleared by the postback process. Is there any clever way to prevent this happening? In other words, is there a way in which I could permit the user to load all the browsers before he starts to upload any file?

    David  

    Thursday, November 20, 2008 5:14 PM

Answers

  • User-1034726716 posted


    Any suggestions on how I could change the logic to select all files before a group upload?

    Hi,

    If you are refering to Multiple File Uploading then these articles below might help you to get started:

    http://www.asp.net/Learn/videos/video-252.aspx

    http://dotnetslackers.com/articles/aspnet/Upload_multiple_files_using_the_HtmlInputFile_control.aspx

    http://www.codeproject.com/KB/aspnet/FlashUpload.aspx

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 20, 2008 7:46 PM

All replies

  • User896700311 posted

    Hi,

    This is the default behavior of the control... after postback... it will be cleared...

    however, you can get (with javascript) the value property (the filename ;s)... but it is useless... because you will do not can to set it again... that property is readonly.

    You must upload the files, one to one... or to change your logic so that select first all files and, after that ... with a single button upload them.

    Any doubt, post your comment.

    Thursday, November 20, 2008 6:46 PM
  • User695372294 posted

    You must upload the files, one to one... or to change your logic so that select first all files and, after that ... with a single button upload them.

    Hi Segundo,
    Any suggestions on how I could change the logic to select all files before a group upload?

    David

    Thursday, November 20, 2008 6:52 PM
  • User-1034726716 posted


    Any suggestions on how I could change the logic to select all files before a group upload?

    Hi,

    If you are refering to Multiple File Uploading then these articles below might help you to get started:

    http://www.asp.net/Learn/videos/video-252.aspx

    http://dotnetslackers.com/articles/aspnet/Upload_multiple_files_using_the_HtmlInputFile_control.aspx

    http://www.codeproject.com/KB/aspnet/FlashUpload.aspx

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, November 20, 2008 7:46 PM
  • User695372294 posted

    Hi Vinz,
    Thanks for the suggestions, but none of your links appear to use the asp:FileUpload control. My website will be going live very soon so I don't want to make big changes to my design at this stage.

    David

    Friday, November 21, 2008 6:09 AM
  • User1879544785 posted

    simple answer is no you cannot, might want to look into validation controls to keep the page from doing a postback before you're ready for it.

    Friday, May 15, 2009 4:25 PM