How to use Request.Form() while using BinaryRead

Discussion in 'ASP General' started by Vinay Vasu, Nov 25, 2008.

  1. Vinay Vasu

    Vinay Vasu Guest

    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
     
    Vinay Vasu, Nov 25, 2008
    #1
    1. Advertising

  2. "Vinay Vasu" <> wrote in message
    news:...
    > 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.

    --
    Anthony Jones - MVP ASP/ASP.NET
     
    Anthony Jones, Nov 25, 2008
    #2
    1. Advertising

  3. Vinay Vasu

    Neil Gould Guest

    Hi,

    Vinay Vasu wrote:
    > 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
     
    Neil Gould, Nov 25, 2008
    #3
  4. Vinay Vasu

    Mike Brind Guest

    "Vinay Vasu" <> wrote in message
    news:...
    > 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.

    --
    Mike Brind
    MVP - ASP/ASP.NET
     
    Mike Brind, Nov 25, 2008
    #4
  5. Vinay Vasu

    Vinay Vasu Guest

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

    Thanks Again




    "Vinay Vasu" <> wrote in message
    news:...
    > 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
    >
    >
     
    Vinay Vasu, Dec 1, 2008
    #5
  6. Vinay Vasu

    Ron Hinds Guest

    "Mike Brind" <> wrote in message
    news:uY%...
    >
    > 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!
     
    Ron Hinds, Dec 15, 2008
    #6
  7. Vinay Vasu

    Mike Brind Guest

    "Ron Hinds" <> wrote in message
    news:...
    > "Mike Brind" <> wrote in message
    > news:uY%...
    >>
    >> 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!
    >


    There's plenty of help for ASP.NET at www.asp.net. There's also a bunch of
    video tutorials:
    http://www.asp.net/learn/videos/default.aspx?supportsjs=true. Number 32
    seems to be what you are looking for.

    --
    Mike Brind
    MVP - ASP/ASP.NET
     
    Mike Brind, Dec 16, 2008
    #7
  8. Vinay Vasu

    Ron Hinds Guest

    "Mike Brind" <> wrote in message
    news:...
    >
    > "Ron Hinds" <> wrote in message
    > news:...
    >> "Mike Brind" <> wrote in message
    >> news:uY%...
    >>>
    >>> 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!
    >>

    >
    > There's plenty of help for ASP.NET at www.asp.net. There's also a bunch of
    > video tutorials:
    > http://www.asp.net/learn/videos/default.aspx?supportsjs=true. Number 32
    > seems to be what you are looking for.
    >
    > --
    > Mike Brind
    > MVP - ASP/ASP.NET


    Thank you!
     
    Ron Hinds, Dec 16, 2008
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Birtle
    Replies:
    2
    Views:
    2,194
    John Saunders
    Oct 16, 2003
  2. Lau Lei Cheong

    Question about using Request.BinaryRead()

    Lau Lei Cheong, Aug 23, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    678
    bruce barker
    Aug 23, 2004
  3. Nikhil
    Replies:
    1
    Views:
    200
    GVaught
    Sep 11, 2003
  4. Replies:
    0
    Views:
    372
  5. Griff
    Replies:
    2
    Views:
    537
Loading...

Share This Page