HtmlFileInput control PostBack

G

Guest

Within a form in an application I have section where the user selects the
number of files they need to upload. Using Javascript I right the
HtmlFileInput boxes within span element on the page. I have an object that I
wrote that will accept the HttpPostedFile and do some processing. However, I
get an "Object reference not set to an instance of an object" on the postback
when I try to reference one of the input fields.

I realized this is because the controls were not part of the controls
collection when the page loaded. If I do a Request.Files I get 0.

Does anyone have any idea how I can use a Javascript function to write
htmlfileinput controls to a page and then get the request.files collection on
postback when the user clicks a submit button? Note: This file upload section
is contained within a form with several other fields (webform controls) that
must be processed also.

I really want to avoid a postback on selectedindexchanged on the
dropdownlist that the user selects the number of files.

Thanks a bunch.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top