Solved

Request.BinaryRead failed

Posted on 2001-07-10
7
796 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
API works for 1 result, need to make it many 30 85
Want the count number from this QUery 2 49
Error in query expression 3 44
Connection to multiple databases 13 20
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 …
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 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