Results 1 to 7 of 7

Thread: Who can help me translate the follow sentence¡¯s means? Thanks

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Posts
    4

    Who can help me translate the follow sentence¡¯s means? Thanks

    'Who can help me translate the follow sentence¡¯s means? Thanks

    formdata=request.binaryread(formsize)
    bncrlf=chrB(13) & chrB(10)
    divider=leftB(formdata,clng(instrb(formdata,bncrlf))-1)
    datastart=instrb(formdata,bncrlf & bncrlf)+4
    dataend=instrb(datastart+1,formdata,divider)-datastart
    mydata=midb(formdata,datastart,dataend)
    a poor man

  2. #2
    Hyperactive Member Al Smith's Avatar
    Join Date
    May 1999
    Location
    Marcellus, MI. USA
    Posts
    330
    Hi,
    I'll try.
    Code:
    formdata=request.binaryread(formsize)
    BinaryRead is used to read the raw data sent to the server by the client as part of a POST request.
    formsize is the number of bytes to read.
    formdata will contain the BinaryRead data. The data will be formsize long.
    Code:
    bncrlf=chrB(13) & chrB(10)
    Setting a variable for carriage return & line feed. Normally used to mark the end-of-line.
    Code:
    divider=leftB(formdata,clng(instrb(formdata,bncrlf))-1)
    divider will contain the left most data from formdata.
    divider will only contain the data up to where the first bncrlf is found.
    Code:
    datastart=instrb(formdata,bncrlf & bncrlf)+4
    datastart is the number of the position where 2 consecutive bncrlf's are found in formdata.
    4 is added to get the number past the 2 consecutive bncrlf's.
    Code:
    dataend=instrb(datastart+1,formdata,divider)-datastart
    dataend is the number where the binary string in divider is found within formdata but not from the beginning.
    dataend starts at the number in datastart+1. Then the number of the position where divider is found. Then the number of datastart is subtracted.
    dataend is actually setting the length for the next statement.
    Code:
    mydata=midb(formdata,datastart,dataend)
    mydata will contain the data from formdata starting at datastart. It will be dataend long.

    What the code appears to be doing is extracting certain portions of the raw data sent to a server by a client.

    I hope this helps,
    Al.
    A computer is a tool, not a toy.

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Posts
    4

    I want to another help?

    Thank you very much for giving my great help.

    This code is order to submit a form which only includes a picture to server,I want to know why need to extract certain portions of the raw data sent to a server by a client? do you help me?

    Thank you!
    a poor man

  4. #4
    Hyperactive Member Al Smith's Avatar
    Join Date
    May 1999
    Location
    Marcellus, MI. USA
    Posts
    330
    Hi,
    It's possible that this routine extracts the picture portion only from the information sent to the server. This would explain the "BinaryRead".
    The picture information would be embedded in the raw data stream sent to the server.
    The extracted information would be in the variable "mydata" in the code you submitted. The rest of the code should show you what's being done with the extracted data.
    Al.
    A computer is a tool, not a toy.

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Posts
    4

    Thank you very much, but I want to your help again. Do you help me again?

    Thank you very much, but I want to your help again. Do you help me again?

    The following is the form, this form only include a picture,


    <form name="mainForm" enctype="multipart/form-data" action="process.asp" method=post>
    <input type=file name=mefile>
    <input type=submit name=ok value="OK">
    </form>

    I want to know why need to get rid of some certain portions of the raw data? What is the data get rid of?

    Thank you!
    a poor man

  6. #6
    Hyperactive Member Al Smith's Avatar
    Join Date
    May 1999
    Location
    Marcellus, MI. USA
    Posts
    330
    Hi,
    It's eliminating the non-picture information that's submitted with a post method. e.g. Header info, button info, etc.
    Below is some code that will show you this. It's a modified version of the code in your first post. Copy it to your server and point the picture form to it.
    Notice the last 2 lines. Right now it's set up to write the complete raw data back to the client. If you rem out the Response.BinaryWrite formdata and un-rem the Response.BinaryWrite mydata you can see the difference.
    Al.
    Code:
    <%
    formsize=Request.TotalBytes
    formdata=request.binaryread(formsize) 
    bncrlf=chrB(13) & chrB(10) 
    divider=leftB(formdata,clng(instrb(formdata,bncrlf))-1) 
    datastart=instrb(formdata,bncrlf & bncrlf)+4 
    dataend=instrb(datastart+1,formdata,divider)-datastart 
    mydata=midb(formdata,datastart,dataend)
    
    Response.BinaryWrite formdata
    
    'Response.BinaryWrite mydata
    %>
    A computer is a tool, not a toy.

  7. #7

    Thread Starter
    New Member
    Join Date
    Apr 2002
    Posts
    4

    I want to help again?

    Thank you for giving my help again. Now I almost have already understood this function, but I want you help me the last time. Do you help me translate the follow sentence ¡®s means detailed?
    Will there be found the ¡®divider¡¯ in ¡®formadata¡¯? If found, I want to know why will be found two time?

    divider=leftB(formdata,clng(instrb(formdata,bncrlf))-1)
    dataend=instrb(datastart+1,formdata,divider)-datastart

    I used the follow sentence to display some information
    Response.BinaryWrite formdata ¡®one
    Response.write ¡°<br><br><br>¡±
    Response.BinaryWrite mydata ¡®two

    I found that use one input more information than two. I found that it is different between the front excrescent and the back excrescent. Now that it is different I do not know how to translate the sentence ¡®dataend=instrb(datastart+1,formdata,divider)-datastart ¡®? I do not know how to find the back excrescent information?
    a poor man

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width