Solved

How to get the ENCTYPE of a form

Posted on 2000-05-02
2
502 Views
Last Modified: 2008-02-01
I have an ASP page that needs to handle two different types of forms -- the first being the default enctype: "form/url-encoded", and the second (for file uploading) being of enctype "multipart/form-data".  The problem is this:

The ASP Request object will not work if the encoding is multipart.  I can't use the Request object to tell if the encoding is (or isn't) multipart, because if it is, once I use the Request object, I can no longer do a binary read.  Also, if I attempt a binary read and the encoding is form/url-encoded, then I get a "corrupt MIME headers" error.

So the question is -- how can I tell the ENCTYPE encoding of a form without using the request object AND without using "on error resume next"

Thanks
0
Comment
Question by:knightEknight
2 Comments
 
LVL 25

Accepted Solution

by:
clockwatcher earned 50 total points
Comment Utility
You can access the request object's ServerVariables collection.  You just can't use both the Request.Form collection and the BinaryRead method together.

The server variable you're looking for is HTTP_CONTENT_TYPE.

E.g.,

contenttype = request.servervariables("HTTP_CONTENT_TYPE")

if contenttype = "application/x-www-form-urlencoded" then
  response.write "Normal"
  x = request.form("whatever")
else
  response.write "Upload"
  x = request.binaryread(request.servervariables("content_length"))
end if
0
 
LVL 33

Author Comment

by:knightEknight
Comment Utility
Thanks, I should have known that  :)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now