ENCTYPE and Response.Form.Item(...) conflict?

N

nick

I have an simple ASP form and I am using the following statement to get the
values:

emailFrom = Request.Form.Item("ctrl:EmailFrom")
emailTo = Request.Form.Item("ctrl:EmailTo")

However, after I added attribute ENCTYPE="multipart/form-data" to the HTML
tag <Form> for uploading files (not implemented yet). The above code doesn't
work and the value of Request.Form.Item("...") become "Undefined".

How to solve the problem? Thanks.
 
D

Dave Anderson

nick said:
...after I added attribute ENCTYPE="multipart/form-data" to the
HTML tag <Form> for uploading files (not implemented yet). The above
code doesn't work and the value of Request.Form.Item("...") become
"Undefined".

Consider this:
http://www.w3.org/TR/1998/REC-html40-19980424/interact/forms.html#form-content-type

[multipart/form-data]

The content "multipart/form-data" follows the rules of all multipart
MIME data streams as outlined in [RFC2045]...

A "multipart/form-data" message contains a series of parts, each
representing a successful control. The parts are sent to the
processing agent in the same order the corresponding controls appear
in the document stream...

Each part is expected to contain:
1. a "Content-Disposition" header whose value is "form-data".
2. a name attribute specifying the control name of the
corresponding control...

Thus, for example, for a control named "mycontrol", the corresponding
part would be specified:

Content-Disposition: form-data; name="mycontrol"

As with all MIME transmissions, "CR LF" (i.e., `%0D%0A') is used to
separate lines of data.



Take a look here. The devil is in the details.
http://msdn.microsoft.com/library/en-us/dnasdj01/html/asp0900.asp


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
 

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

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top