Solved

How to get the ENCTYPE of a form

Posted on 2000-05-02
2
550 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 25

Accepted Solution

by:
clockwatcher earned 50 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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

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…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

617 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