FileUpload PostedFile after Postback question

Discussion in 'ASP .Net' started by ronc85, Jun 5, 2007.

  1. ronc85

    ronc85 Guest

    My environment is ASP.NET 2.0, C# and AJAX.

    Is there a way to retain the Postedfile in the FileUpload control
    after Postback? I have this application I've inherited were the User
    chooses a file then clicks the "save" button, the program proceeds to
    edit the file on the server and if it detects an error displays an
    error message. At this point the filename is lost from the FileUpload
    input field.

    Sal P.
     
    ronc85, Jun 5, 2007
    #1
    1. Advertisements

  2. ronc85

    Guest Guest

    It is 'by design', for security reasons. The idea is that users should know
    and explicitly select a file for upload. Hence cannot be retained across
    postbacks.
     
    Guest, Jun 5, 2007
    #2
    1. Advertisements

  3. ronc85

    GenCode Guest

    Actually the FileUpload retains its state just fine after
    postback...it only gets null'ed when dropped into an AJAX panel, when
    the panel is removed it retains its state again even after
    postback...so I have doubts that it is a question of security.
     
    GenCode, Jun 19, 2007
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.