Solved

Request.BinaryRead failed

Posted on 2001-07-10
7
798 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 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
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.

 
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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

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

733 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