?
Solved

Request.BinaryRead failed

Posted on 2001-07-10
7
Medium Priority
?
805 Views
Last Modified: 2013-12-03
I create a simple upload form with one file item. It works fine on the server!

But, I created a member page like this.

religion
occupation
interests/hobbies
...
...
...
photo (upload)


<form method="POST" ENCTYPE="multipart/form-data" action="mdb.asp">
<p><input type="text" name="Religion" size="20"><b><font face="Arial" size="2">Religion</font></b></p>
<p><input type="text" name="Occupation" size="20"><b><font face="Arial" size="2">Occupation</font></b></p>
<p><b><font face="Arial" size="2">Please describe your interest and/or hobbies below. Please use at
least 100 characters and less than 250.</font></b></p>
<p><textarea rows="6" name="Interest" cols="41"></textarea></p>
<p><input type="file" name="UploadForm" size="30"><b><font face="Arial" size="2">Select a photo to upload</font></b></p>
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>


mdb.asp
---------
strmreligion = Request.Form("Religion")
strmoccuptation = Request.Form("Occupation")
strminterest = Request.Form("Interest")

Dim oRsMember, Upload

Set oRsMember = Server.CreateObject("Adodb.Recordset")
Set Upload = Server.CreateObject("Persits.Upload.1")

Upload.Save "\photo\"

Set File = Upload.Files("UploadForm")

strCriteriaMember = "Select * FROM Contacts ORDER BY MemberID DESC"

oRsMember.Open strCriteriaMember, oConn, adOpenDynamic, adLockOptimistic, adCmdText

If not (oRsMember.BOF And oRsMember.EOF) then

oRsMember.AddNew
oRsMember("Religion") = strmreligion
oRsMember("Occupation") = strmoccupation
oRsMember("Interest") = strminterest
oRsMember("Timestamp") = now
oRsMember("MemberPhoto") = File.ExtractFileName
oRsMember.Update

End If

oRsMember.Close
Set oRsMember = Nothing


I got an error saying "Request.BinaryRead failed."
How can I fix it?
0
Comment
Question by:computer1000
  • 4
  • 2
7 Comments
 

Author Comment

by:computer1000
ID: 6271395
The error points to the line -- Upload.Save "\photo\"
0
 
LVL 18

Accepted Solution

by:
mgfranz earned 200 total points
ID: 6271494
You can't mix "multipart/form-data" with text/plain fields...

You will have to break up the <form> fields.
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 6271507
What you will have to do is break-up the <form> pages, one for the image upload, another for the text fields, like this;

<FORM METHOD="Post" ENCTYPE="multipart/form-data" ACTION="aFile.asp" name="form1">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
      <td valign="top"><p><input type="file" name="UploadForm" size="30"><b><font face="Arial" size="2">Select a photo to upload</font></b></p>
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p></td>
</tr>
<tr>
</table>
</form>

Now run the text field form; (where <%=filename%> is the passed in image)

<FORM METHOD="Post" action="mdb.asp" name="form1">
<input type="hidden" name="filename" value="<%=filename%>">
<p><input type="text" name="Religion" size="20"><b><font face="Arial" size="2">Religion</font></b></p>
<p><input type="text" name="Occupation" size="20"><b><font face="Arial" size="2">Occupation</font></b></p>
<p><b><font face="Arial" size="2">Please describe your interest and/or hobbies below. Please use at least 100 characters and less than 250.</font></b></p>
<p><textarea rows="6" name="Interest" cols="41"></textarea></p>
...
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:weesiong
ID: 6271959
computer1000,

What you will have to do is break-up the <form> pages, one for the image upload, another for the text
fields, like this;
>Why need 2 form?? A Stupid Way?


mdb.asp
---------
Dim oRsMember, Upload

Set oRsMember = Server.CreateObject("Adodb.Recordset")
Set Upload = Server.CreateObject("Persits.Upload.1")

strmreligion = Upload.Form("Religion")
strmoccuptation = Upload.Form("Occupation")
strminterest = Upload.Form("Interest")

Upload.Save "\photo\"

Set File = Upload.Files("UploadForm")

strCriteriaMember = "Select * FROM Contacts ORDER BY MemberID DESC"

oRsMember.Open strCriteriaMember, oConn, adOpenDynamic, adLockOptimistic, adCmdText

If not (oRsMember.BOF And oRsMember.EOF) then

oRsMember.AddNew
oRsMember("Religion") = strmreligion
oRsMember("Occupation") = strmoccupation
oRsMember("Interest") = strminterest
oRsMember("Timestamp") = now
oRsMember("MemberPhoto") = File.ExtractFileName
oRsMember.Update

End If

oRsMember.Close
Set oRsMember = Nothing


Regards,
Wee SIong
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 6273265
Wee, the problem is the ENCTYPE in the form, ENCTYPE does not process text data.
0
 

Author Comment

by:computer1000
ID: 6274219
Mgfranz: thanks a lot.
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 6274258
Your welcome.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
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/…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

862 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