?
Solved

Request.BinaryRead failed

Posted on 2001-07-10
7
Medium Priority
?
801 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
[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
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

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…
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…
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…

764 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