How to use Request.Form() while using BinaryRead

V

Vinay Vasu

Hi All,

I am able to upload the files but when i put a check like
Request.Form("subimt") <> "" it gives me error

Error Type:
Request object, ASP 0206 (0x80004005)
Cannot call BinaryRead after using Request.Form collection.

if i put the Request.form anywhere in the page it gives me error
Cannot call BinaryRead after / before using Request.Form collection


And if i am not using the Request.Form object and try using the BinaryRead's
form collection script it gives me the following error:

Microsoft VBScript runtime (0x800A0005) Invalid procedure call or argument:
'MidB' on line 141

where in line 141 I find is :
separator = MidB(rawData, 1, InstrB(1, rawData, ChrB(13)) - 1)


My application runs this way:

I need to upload files based on the subject. The subject is selected in the
first page and then submitted to the topics page where the Upload script is
written.
I first have to check wether the Request.Form is null or not and only then
run the upload script.


Is there any other way to the same thing, any help would be highly
appreciated

Thanks in advance,
Vinay Vasu
 
A

Anthony Jones

Vinay Vasu said:
Hi All,

I am able to upload the files but when i put a check like
Request.Form("subimt") <> "" it gives me error

Error Type:
Request object, ASP 0206 (0x80004005)
Cannot call BinaryRead after using Request.Form collection.

if i put the Request.form anywhere in the page it gives me error
Cannot call BinaryRead after / before using Request.Form collection


And if i am not using the Request.Form object and try using the
BinaryRead's form collection script it gives me the following error:

Microsoft VBScript runtime (0x800A0005) Invalid procedure call or
argument: 'MidB' on line 141

where in line 141 I find is :
separator = MidB(rawData, 1, InstrB(1, rawData, ChrB(13)) - 1)


My application runs this way:

I need to upload files based on the subject. The subject is selected in
the first page and then submitted to the topics page where the Upload
script is written.
I first have to check wether the Request.Form is null or not and only then
run the upload script.


Is there any other way to the same thing, any help would be highly
appreciated

ASPs Form collection is incompatible with file uploads. You haven't
specified how you upload but my guess would be via HTML Forms file input, in
which case you will be using multipart mime format. You need an additional
server side component like AspUpload (which many hosting services provide
for you or an equivalent). There are I believe some examples of pure
VBScript code handling it which you can use at a push but they're real ugly.
 
N

Neil Gould

Hi,

Vinay said:
Hi All,

I am able to upload the files but when i put a check like
Request.Form("subimt") <> "" it gives me error

Error Type:
Request object, ASP 0206 (0x80004005)
Cannot call BinaryRead after using Request.Form collection.

if i put the Request.form anywhere in the page it gives me error
Cannot call BinaryRead after / before using Request.Form collection


And if i am not using the Request.Form object and try using the
BinaryRead's form collection script it gives me the following error:

Microsoft VBScript runtime (0x800A0005) Invalid procedure call or
argument: 'MidB' on line 141

where in line 141 I find is :
separator = MidB(rawData, 1, InstrB(1, rawData, ChrB(13)) - 1)


My application runs this way:

I need to upload files based on the subject. The subject is selected
in the first page and then submitted to the topics page where the
Upload script is written.
I first have to check wether the Request.Form is null or not and only
then run the upload script.


Is there any other way to the same thing, any help would be highly
appreciated

Thanks in advance,
Vinay Vasu
As Anthony has pointed out, the Form object is not compatible with binary
reads used for file uploads. One way around this is to employ two separate
operations, one to process your form and store the relevant information in
Session variables, then the other to run the upload process, inserting the
Session variable data.

Hope this helps,

Neil
 
M

Mike Brind

Vinay Vasu said:
Hi All,

I am able to upload the files but when i put a check like
Request.Form("subimt") <> "" it gives me error

Error Type:
Request object, ASP 0206 (0x80004005)
Cannot call BinaryRead after using Request.Form collection.

if i put the Request.form anywhere in the page it gives me error
Cannot call BinaryRead after / before using Request.Form collection


And if i am not using the Request.Form object and try using the
BinaryRead's form collection script it gives me the following error:

Microsoft VBScript runtime (0x800A0005) Invalid procedure call or
argument: 'MidB' on line 141

where in line 141 I find is :
separator = MidB(rawData, 1, InstrB(1, rawData, ChrB(13)) - 1)


My application runs this way:

I need to upload files based on the subject. The subject is selected in
the first page and then submitted to the topics page where the Upload
script is written.
I first have to check wether the Request.Form is null or not and only then
run the upload script.


Is there any other way to the same thing, any help would be highly
appreciated

In addition to the help provided already, you may be able to consider
incorporating an ASP.NET page or two in your site to handle this. ASP.NET
offers a free file upload control that is many times better than pure
VBScript classic ASP ones.
 
V

Vinay Vasu

Thanks Anthony, Neil, Mike and Jon for your prompt reply, Ill try all the
options you have provided.

Thanks Again
 
R

Ron Hinds

Mike Brind said:
In addition to the help provided already, you may be able to consider
incorporating an ASP.NET page or two in your site to handle this. ASP.NET
offers a free file upload control that is many times better than pure
VBScript classic ASP ones.

Hi Mike - could you elaborate on how to do this - i.e., do you have a link
to an article or something? Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top