Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > hm.. how do I dynamically load multiple html fileuploaders?

Reply
Thread Tools

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

 
 
robert112
Guest
Posts: n/a
 
      06-19-2007
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.

 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      06-19-2007
Check the Request.Files collection that directly exposes uploaded files...

--
Patrice


"robert112" <(E-Mail Removed)> a écrit dans le message de news:
(E-Mail Removed) m...
> 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.
>



 
Reply With Quote
 
 
 
 
robert112
Guest
Posts: n/a
 
      06-25-2007
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" <(E-Mail Removed)> a écrit dans le message de news:
> (E-Mail Removed) m...
>
> > 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Can I dynamically load html page into my aspx page? Earl Teigrob ASP .Net 6 09-27-2007 11:10 PM
Load User Control Dynamically, Cast object dynamically =?Utf-8?B?UmV6YSBOYWJp?= ASP .Net 1 03-05-2005 12:04 AM
Load User Control Dynamically, Cast object dynamically =?Utf-8?B?UmV6YSBOYWJp?= ASP .Net 1 03-04-2005 07:57 PM
RE: dynamically load a HTML page (or a Word document), =?Utf-8?B?U3VyZXNo?= ASP .Net 1 02-25-2004 06:11 PM



Advertisments