hm.. how do I dynamically load multiple html fileuploaders?

Discussion in 'ASP .Net' started by robert112, Jun 19, 2007.

  1. robert112

    robert112 Guest

    This is quite a hard one guys.
    ***Some necessary back ground Info***

    I have an asp.net 1.1 application that uses a WYSIWYG to return some
    html created by the user in the admin section of the application. The
    html that the user creates is a survey or form made up of textbox's,
    radio buttons and drop downs. The form gets saved to a sql database
    which then can be viewed on the front end of the application. The way
    I do this is have a label on the page and set it's text property to
    the html.
    This works well but has it's limitations.
    This means that I do NOT have programmatic access to these controls
    because
    a) their not server side html controls
    b) their not web controls.

    They are purely 'text'. I collect the values by looping through the
    request.form collection and do any data validation or processing by
    finding out the name of the control in question using the
    system.string.indexof method and basically just using string
    manipulation to do any work needed.

    ***Now the problem***
    Business requirements now require the user to be able to also include
    multiple html file upload elements on the form page. Because this is
    not a .net web control or server side html control I don't have any
    object's I can work with.

    Normally you would access the 'saveas' method of the htmlfileinput
    class to save the stream onto hard disk right?

    Well I do not have an object to call the saveas method on nor did I
    have the luxury of creating the element during runtime. It's dynamic!
    Infact, during runtime the only way I can see that there is a html
    input file element on the page is from the following command in the
    debug command window:

    ? CType(Page.Controls(2).Controls(5).Controls(4), Label).Text
    This brings me back the label control that is in the web user control
    that sits on the page. here is some live test data:

    "<p>Please Select Age:</p>
    <p><input type="radio" name="rbRadio" class="radiobutton" value="on" /
    ></p>

    <p><input type="radio" name="rbRadio" class="radiobutton" value="on" /
    ></p>

    <p><input type="radio" name="rbRadio" class="radiobutton" value="on" /
    ></p>

    <p>FirstName: <input name="txtFirstname" type="text" value=""/></p>
    <p>Test checkbox: <input type="checkbox" name="chkbTest" value="on" /
    ></p>

    <p>&nbsp;</p>
    <p><input type="file" name="hfFileUploader" /></p>"

    as you can see I want to let the user upload a file through the html
    element "htFileUploader" but I don't have any handles to any objects
    to call save as on.

    Also, I cannot access the upload stream through request.form either.

    I am out of ideas and any alternatives, hacks or work arounds would be
    greatly appreciated.

    Thanks,
    -Robert.
    robert112, Jun 19, 2007
    #1
    1. Advertising

  2. robert112

    Patrice Guest

    Check the Request.Files collection that directly exposes uploaded files...

    --
    Patrice


    "robert112" <> a écrit dans le message de news:
    ...
    > This is quite a hard one guys.
    > ***Some necessary back ground Info***
    >
    > I have an asp.net 1.1 application that uses a WYSIWYG to return some
    > html created by the user in the admin section of the application. The
    > html that the user creates is a survey or form made up of textbox's,
    > radio buttons and drop downs. The form gets saved to a sql database
    > which then can be viewed on the front end of the application. The way
    > I do this is have a label on the page and set it's text property to
    > the html.
    > This works well but has it's limitations.
    > This means that I do NOT have programmatic access to these controls
    > because
    > a) their not server side html controls
    > b) their not web controls.
    >
    > They are purely 'text'. I collect the values by looping through the
    > request.form collection and do any data validation or processing by
    > finding out the name of the control in question using the
    > system.string.indexof method and basically just using string
    > manipulation to do any work needed.
    >
    > ***Now the problem***
    > Business requirements now require the user to be able to also include
    > multiple html file upload elements on the form page. Because this is
    > not a .net web control or server side html control I don't have any
    > object's I can work with.
    >
    > Normally you would access the 'saveas' method of the htmlfileinput
    > class to save the stream onto hard disk right?
    >
    > Well I do not have an object to call the saveas method on nor did I
    > have the luxury of creating the element during runtime. It's dynamic!
    > Infact, during runtime the only way I can see that there is a html
    > input file element on the page is from the following command in the
    > debug command window:
    >
    > ? CType(Page.Controls(2).Controls(5).Controls(4), Label).Text
    > This brings me back the label control that is in the web user control
    > that sits on the page. here is some live test data:
    >
    > "<p>Please Select Age:</p>
    > <p><input type="radio" name="rbRadio" class="radiobutton" value="on" /
    >></p>

    > <p><input type="radio" name="rbRadio" class="radiobutton" value="on" /
    >></p>

    > <p><input type="radio" name="rbRadio" class="radiobutton" value="on" /
    >></p>

    > <p>FirstName: <input name="txtFirstname" type="text" value=""/></p>
    > <p>Test checkbox: <input type="checkbox" name="chkbTest" value="on" /
    >></p>

    > <p>&nbsp;</p>
    > <p><input type="file" name="hfFileUploader" /></p>"
    >
    > as you can see I want to let the user upload a file through the html
    > element "htFileUploader" but I don't have any handles to any objects
    > to call save as on.
    >
    > Also, I cannot access the upload stream through request.form either.
    >
    > I am out of ideas and any alternatives, hacks or work arounds would be
    > greatly appreciated.
    >
    > Thanks,
    > -Robert.
    >
    Patrice, Jun 19, 2007
    #2
    1. Advertising

  3. robert112

    robert112 Guest

    On Jun 19, 6:07 pm, "Patrice" <http://www.chez.com/scribe/> wrote:
    > Check the Request.Files collection that directly exposes uploaded files...
    >
    > --
    > Patrice
    >
    > "robert112" <> a écrit dans le message de news:
    > ...
    >
    > > This is quite a hard one guys.
    > > ***Some necessary back ground Info***

    >
    > > I have an asp.net 1.1 application that uses a WYSIWYG to return some
    > > html created by the user in the admin section of the application. The
    > > html that the user creates is a survey or form made up of textbox's,
    > > radio buttons and drop downs. The form gets saved to a sql database
    > > which then can be viewed on the front end of the application. The way
    > > I do this is have a label on the page and set it's text property to
    > > the html.
    > > This works well but has it's limitations.
    > > This means that I do NOT have programmatic access to these controls
    > > because
    > > a) their not server side html controls
    > > b) their not web controls.

    >
    > > They are purely 'text'. I collect the values by looping through the
    > > request.form collection and do any data validation or processing by
    > > finding out the name of the control in question using the
    > > system.string.indexof method and basically just using string
    > > manipulation to do any work needed.

    >
    > > ***Now the problem***
    > > Business requirements now require the user to be able to also include
    > > multiple html file upload elements on the form page. Because this is
    > > not a .net web control or server side html control I don't have any
    > > object's I can work with.

    >
    > > Normally you would access the 'saveas' method of the htmlfileinput
    > > class to save the stream onto hard disk right?

    >
    > > Well I do not have an object to call the saveas method on nor did I
    > > have the luxury of creating the element during runtime. It's dynamic!
    > > Infact, during runtime the only way I can see that there is a html
    > > input file element on the page is from the following command in the
    > > debug command window:

    >
    > > ? CType(Page.Controls(2).Controls(5).Controls(4), Label).Text
    > > This brings me back the label control that is in the web user control
    > > that sits on the page. here is some live test data:

    >
    > > "<p>Please Select Age:</p>
    > > <p><input type="radio" name="rbRadio" class="radiobutton" value="on" /
    > >></p>

    > > <p><input type="radio" name="rbRadio" class="radiobutton" value="on" /
    > >></p>

    > > <p><input type="radio" name="rbRadio" class="radiobutton" value="on" /
    > >></p>

    > > <p>FirstName: <input name="txtFirstname" type="text" value=""/></p>
    > > <p>Test checkbox: <input type="checkbox" name="chkbTest" value="on" /
    > >></p>

    > > <p>&nbsp;</p>
    > > <p><input type="file" name="hfFileUploader" /></p>"

    >
    > > as you can see I want to let the user upload a file through the html
    > > element "htFileUploader" but I don't have any handles to any objects
    > > to call save as on.

    >
    > > Also, I cannot access the upload stream through request.form either.

    >
    > > I am out of ideas and any alternatives, hacks or work arounds would be
    > > greatly appreciated.

    >
    > > Thanks,
    > > -Robert.


    I don't know wether to be happy or sad, your solution worked but I
    only saw it after it was too late and implemented a work around!

    thank you very much. I never knew about this request.files property.
    Silly me, it makes logical sense to look in the request collection for
    incoming data. that includes properties other than those that return
    form data!

    once again, Thank you.
    robert112, Jun 25, 2007
    #3
    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. =?Utf-8?B?U3VyZXNo?=

    RE: dynamically load a HTML page (or a Word document),

    =?Utf-8?B?U3VyZXNo?=, Feb 25, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    447
    =?Utf-8?B?S25vdEtub3JtYWw=?=
    Feb 25, 2004
  2. Earl Teigrob
    Replies:
    6
    Views:
    7,873
    wadewalker25
    Sep 28, 2007
  3. =?Utf-8?B?UmV6YSBOYWJp?=

    Load User Control Dynamically, Cast object dynamically

    =?Utf-8?B?UmV6YSBOYWJp?=, Mar 4, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    6,716
    Matt Berther
    Mar 5, 2005
  4. =?Utf-8?B?UmV6YSBOYWJp?=

    Load User Control Dynamically, Cast object dynamically

    =?Utf-8?B?UmV6YSBOYWJp?=, Mar 4, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    6,352
    Scott Allen
    Mar 4, 2005
  5. Johnny
    Replies:
    4
    Views:
    412
    dorayme
    Dec 31, 2007
Loading...

Share This Page