How to Persist HtmlInputFile Value through postback?

Discussion in 'ASP .Net' started by Dave Adler, Feb 18, 2004.

  1. Dave Adler

    Dave Adler Guest

    Is there any way to retain the value of an HtmlInputFile control through a
    postback?

    I do some server side validation on the page when it is submitted and if an
    error occurs on the page the HtmlInputFile control value is blank after the
    postback. The EnableViewState for the control is set to true. I can't put
    the postedFile.filename value in a hidden control and then put it back into
    the HtmlInputFile control on postback because the postedFile.filename and
    the value properties are read-only.

    Any ideas?

    Thanks in advance

    David
    Dave Adler, Feb 18, 2004
    #1
    1. Advertising

  2. No for security reasons.

    You could probably still perhaps do tricky things such as using (inline)
    frames (allowing to keep a part that doesn't get refreshed).

    Patrice

    --

    "Dave Adler" <> a écrit dans le message de
    news:...
    > Is there any way to retain the value of an HtmlInputFile control through a
    > postback?
    >
    > I do some server side validation on the page when it is submitted and if

    an
    > error occurs on the page the HtmlInputFile control value is blank after

    the
    > postback. The EnableViewState for the control is set to true. I can't put
    > the postedFile.filename value in a hidden control and then put it back

    into
    > the HtmlInputFile control on postback because the postedFile.filename and
    > the value properties are read-only.
    >
    > Any ideas?
    >
    > Thanks in advance
    >
    > David
    >
    >
    Patrice Scribe, Feb 18, 2004
    #2
    1. Advertising

  3. Dave Adler

    Teemu Keiski Guest

    Hi,

    no there isn't as this is security related (if you could write to it, you
    could theoretically upload files from client without user knowing that)

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist

    "Dave Adler" <> wrote in message
    news:...
    Is there any way to retain the value of an HtmlInputFile control through a
    postback?

    I do some server side validation on the page when it is submitted and if an
    error occurs on the page the HtmlInputFile control value is blank after the
    postback. The EnableViewState for the control is set to true. I can't put
    the postedFile.filename value in a hidden control and then put it back into
    the HtmlInputFile control on postback because the postedFile.filename and
    the value properties are read-only.

    Any ideas?

    Thanks in advance

    David
    Teemu Keiski, Feb 18, 2004
    #3
  4. Dave Adler

    bruce barker Guest

    you shouldn't do much serverside validation on HtmlInputFile , as the file
    is actually uploaded, you shouldn't require a second upload. at least cache
    the file, and do secondary processing after.

    -- bruce (sqlwork.com)


    "Dave Adler" <> wrote in message
    news:...
    > Is there any way to retain the value of an HtmlInputFile control through a
    > postback?
    >
    > I do some server side validation on the page when it is submitted and if

    an
    > error occurs on the page the HtmlInputFile control value is blank after

    the
    > postback. The EnableViewState for the control is set to true. I can't put
    > the postedFile.filename value in a hidden control and then put it back

    into
    > the HtmlInputFile control on postback because the postedFile.filename and
    > the value properties are read-only.
    >
    > Any ideas?
    >
    > Thanks in advance
    >
    > David
    >
    >
    bruce barker, Feb 18, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bruce barker
    Replies:
    0
    Views:
    905
    bruce barker
    Aug 4, 2004
  2. Grey
    Replies:
    2
    Views:
    598
    Sayed Hashimi
    Sep 7, 2004
  3. newmem

    HtmlInputFile during postback..

    newmem, Mar 29, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    2,096
    Brock Allen
    Mar 29, 2005
  4. Jeff Richardson

    HtmlInputFile control and Postback

    Jeff Richardson, Oct 1, 2003, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    118
    Jeff Richardson
    Oct 1, 2003
  5. newmem

    HtmlInputFile during postback..

    newmem, Mar 29, 2005, in forum: ASP .Net Web Controls
    Replies:
    5
    Views:
    120
    Brock Allen
    Mar 29, 2005
Loading...

Share This Page