FileUpload Control

Discussion in 'ASP .Net' started by bsm, May 2, 2007.

  1. bsm

    bsm Guest

    Hi,

    I want to Set asp:fileupload Filename at runtime. When I try to do, it
    shows "Readonly" error. Anyway to achieve this.
    bsm, May 2, 2007
    #1
    1. Advertising

  2. bsm

    Aidy Guest

    > I want to Set asp:fileupload Filename at runtime.

    You can't for security reasons.
    Aidy, May 2, 2007
    #2
    1. Advertising

  3. bsm

    Mark Rae Guest

    "bsm" <> wrote in message
    news:...

    > I want to Set asp:fileupload Filename at runtime. When I try to do, it
    > shows "Readonly" error. Anyway to achieve this.


    Absolutely not, for fairly obvious security reasons!

    Imagine a public website with a hidden FileUpload control which uploaded
    people's accounts database, or their Windows password file...

    --
    http://www.markrae.net
    Mark Rae, May 2, 2007
    #3
  4. It is a read-only property and is automatically set by the ASP.NET runtime
    when the user posts back the page with uploaded file from the browser.

    "bsm" wrote:

    > Hi,
    >
    > I want to Set asp:fileupload Filename at runtime. When I try to do, it
    > shows "Readonly" error. Anyway to achieve this.
    >
    >
    =?Utf-8?B?U2l2YSBN?=, May 2, 2007
    #4
  5. bsm

    bsm Guest

    On May 2, 3:43 pm, "Mark Rae" <> wrote:
    > "bsm" <> wrote in message
    >
    > news:...
    >
    > > I want to Set asp:fileupload Filename at runtime. When I try to do, it
    > > shows "Readonly" error. Anyway to achieve this.

    >
    > Absolutely not, for fairly obvious security reasons!
    >
    > Imagine a public website with a hidden FileUpload control which uploaded
    > people's accounts database, or their Windows password file...
    >
    > --http://www.markrae.net


    Actually My requirement was-
    I have a File Upload control and one DropDownControl. I set
    AutoPostBack is true to my DDL. After choosing Filecontrol, if i
    change DDL value. The filename has got reset. which our users don't
    like this. Do u have any alternate?
    bsm, May 2, 2007
    #5
  6. bsm

    Mark Rae Guest

    "bsm" <> wrote in message
    news:...

    > The filename has got reset.


    That's right - the filename won't survive the postback...

    > Do u have any alternate?


    No.


    --
    http://www.markrae.net
    Mark Rae, May 2, 2007
    #6
  7. bsm

    bsm Guest

    On May 2, 4:31 pm, "Mark Rae" <> wrote:
    > "bsm" <> wrote in message
    >
    > news:...
    >
    > > The filename has got reset.

    >
    > That's right - the filename won't survive the postback...
    >
    > > Do u have any alternate?

    >
    > No.
    >
    > --http://www.markrae.net


    Thanks for ur immediate support.
    bsm, May 2, 2007
    #7
  8. A FileUpload will not retain its' value between postbacks for security
    reasons. Therefore, as long as the ListBox doesn't post back, you won't have
    a problem.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP

    Printing Components, Email Components,
    FTP Client Classes, Enhanced Data Controls, much more.
    DSI PrintManager, Miradyne Component Libraries:
    http://www.miradyne.net

    "bsm" <> wrote in message
    news:...
    > On May 2, 3:43 pm, "Mark Rae" <> wrote:
    >> "bsm" <> wrote in message
    >>
    >> news:...
    >>
    >> > I want to Set asp:fileupload Filename at runtime. When I try to do, it
    >> > shows "Readonly" error. Anyway to achieve this.

    >>
    >> Absolutely not, for fairly obvious security reasons!
    >>
    >> Imagine a public website with a hidden FileUpload control which uploaded
    >> people's accounts database, or their Windows password file...
    >>
    >> --http://www.markrae.net

    >
    > Actually My requirement was-
    > I have a File Upload control and one DropDownControl. I set
    > AutoPostBack is true to my DDL. After choosing Filecontrol, if i
    > change DDL value. The filename has got reset. which our users don't
    > like this. Do u have any alternate?
    >
    Kevin Spencer, May 3, 2007
    #8
  9. bsm

    bsm Guest

    On May 3, 3:23 pm, "Kevin Spencer" <> wrote:
    > A FileUpload will not retain its' value between postbacks for security
    > reasons. Therefore, as long as the ListBox doesn't post back, you won't have
    > a problem.
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    >
    > Printing Components, Email Components,
    > FTP Client Classes, Enhanced Data Controls, much more.
    > DSI PrintManager, Miradyne Component Libraries:http://www.miradyne.net
    >
    > "bsm" <> wrote in message
    >
    > news:...
    >
    >
    >
    > > On May 2, 3:43 pm, "Mark Rae" <> wrote:
    > >> "bsm" <> wrote in message

    >
    > >>news:...

    >
    > >> > I want to Set asp:fileupload Filename at runtime. When I try to do, it
    > >> > shows "Readonly" error. Anyway to achieve this.

    >
    > >> Absolutely not, for fairly obvious security reasons!

    >
    > >> Imagine a public website with a hidden FileUpload control which uploaded
    > >> people's accounts database, or their Windows password file...

    >
    > >> --http://www.markrae.net

    >
    > > Actually My requirement was-
    > > I have a File Upload control and one DropDownControl. I set
    > > AutoPostBack is true to my DDL. After choosing Filecontrol, if i
    > > change DDL value. The filename has got reset. which our users don't
    > > like this. Do u have any alternate?- Hide quoted text -

    >
    > - Show quoted text -


    Thanks for the information.
    bsm, May 4, 2007
    #9
    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. Uncle Ben

    ASP.NET 2.0 FileUpload control

    Uncle Ben, Mar 23, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    3,780
    Bruce Barker
    Mar 23, 2005
  2. Eric

    FileUpload control.

    Eric, Dec 26, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    5,785
    Ankho
    Nov 3, 2009
  3. Nathan Sokalski
    Replies:
    1
    Views:
    740
    Mark Rae
    Jan 11, 2007
  4. eamon

    FileUpload Control & Image Control

    eamon, Aug 4, 2005, in forum: ASP .Net Web Controls
    Replies:
    2
    Views:
    200
    eamon
    Aug 4, 2005
  5. Nathan Sokalski
    Replies:
    0
    Views:
    249
    Nathan Sokalski
    Jan 11, 2007
Loading...

Share This Page