Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to get the ENCTYPE of a form

Posted on 2000-05-02
2
Medium Priority
?
576 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 200 total points
ID: 2771601
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
ID: 2771640
Thanks, I should have known that  :)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

886 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