Solved

Request.BinaryRead failed

Posted on 2001-07-10
7
794 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 50 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
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…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

760 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now