Solved

How to get the ENCTYPE of a form

Posted on 2000-05-02
2
534 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Passing Parameter to Stored Procedure 4 40
Html split(text) Part2 6 38
JQuery on multiple lines 3 44
ms sql and asp dates 5 40
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…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

739 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