, we may use similar method to obtain the file data.
Dim Formdata.formsize,datastart,clstr,divstr
Formsize=request.totalbytes
Formdata=request.binaryread (Formsize)
CLSTR=CHRB (AMP;CHRB) (10)
DATASTART=INSTRB (FORMDATA.CLSTRAMP;CLSTR) +4
' 4 is the length of the two-carriage return line feed
Divstr=leftb (FORMDATA,INSTRB (FORMDATA,CLSTR)-1)
DATASIZE=INSTRB (DATASTART+1,FORMDATA,DIVSTR)-datastart-2
FORMDATA=
to Len1
Varchar=mid (ascontents,i,1)
VARASC=ASC (varchar)
If VarascIf varasc>255 Then
Varhex=hex (VARASC)
Varlow=left (varhex,2)
Varhigh=right (varhex,2)
Strunicode2ansi=strunicode2ansi ChrB ("h" Varlow) ChrB ("h" Varhigh)
Else
Strunicode2ansi=strunicode2ansi ChrB (VARASC)
End If
Next
End Function
Function Stransi2unicode (ascontents)
' Converts an ANSI-en
Upload data source Elite Area straw farmer and other people
Submit.htm
Upload.asp
Function Binarytoasi (ByVal varstr)
Asi= ""
For I=1 to 3
ASI=ASIAMP;CHR (ASCB (MidB (varstr,i,1))
Next
Binarytoasi=asi
End Function
Formsize=request.totalbytes
Formdata=request.binaryread (request.totalbytes) ' Get uploaded data
BCRLF=CHRB (+) ChrB (10)
Divider=leftb (FORMDATA,CLNG (INSTRB (FORMDATA,BCRLF))-1)
POSITION=
(upload.htm):
The file object is used in the program, so the raw data that is read by the BinaryRead method in the upload.asp is not only the data of the selected file itself, but also the description of the path, type, the form domain name of the file on the user's hard disk, and the related information. So we need to extract the specific contents of the file. According to the analysis, the data's header information and the data dividing line is two pairs of carriage return line character, t
(10) can return line breaks. The normal charcode range is 0-255. However, in the DBCS system, the actual charcode range is-32768 to 65535. Note: The chrb function acts on the byte data contained in the string. Chrb always returns a single byte instead of a single character. A character may be one or two bytes. The chrw function returns a string that contains Unicode. If Unicode is not supported, the functi
The following error occurs when you access a website in a virtual space today:
Microsoft VBScript runtime error '800a0005'
Invalid procedure call or argument: 'chr'
/Admin/INC/upload. Inc, line 75
The English version of the server may be used because
The CHR function returns a string containing the specified characters.CodeRelated characters.
Related Syntax: CHR (charcode)
The necessary charcode parameter is a long string used to recognize a character.
Note: Numbers between 0 and 31 ar
page, and other related information of the file on the user's hard disk. In this way, we need to extract the specific content of the file. According to the analysis, the line between the data header information and the data is two carriage return linefeeds with separated information at the end. We can use the following methods to obtain the file data.Dim formdata. formsize, datastart, clstr, divstrFormsize = request. totalbytesFormdata = request. binaryread (formsize)Clstr =
=request.binaryread ( formsize)
CLSTR=CHRB (CHRB)
datastart=instrb (formdata.clstrclstr) +4
' 4 is the length of a carriage return line feed
Divstr=leftb (FORMDATA,INSTRB (FORMDATA,CLSTR)-1)
DATASIZE=INSTRB (DATASTART+1,FORMDATA,DIVSTR)-datastart-2
formdata=midb (formdata,datastart,datasize)
Formdata is the content of the document.
In the middle according to the need, may carry on the corresponding pro
-disposition:form-data; Name= "The name of the form field"; Filename= "File full path"
Content-type: File type
Binary content of a file
So, is it directly used
Split (Formdata, "-----------------------------7d22131090458")
Can we get the units? The answer is in the negative. First of all, Formdata is not a string but binary string, can not be split method, and secondly, the 7d22131090458 here is not fixed, each time there will be changes, is not suitable for separators. So, you should use a mo
, the picture upload and save the program process.asp
The following are the referenced contents:Response.buffer=trueFormsize=request.totalbytesFormdata=request.binaryread (Formsize)BNCRLF=CHRB (+) ChrB (10)Divider=leftb (FORMDATA,CLNG (INSTRB (FORMDATA,BNCRLF))-1)DATASTART=INSTRB (Formdata,bncrlf Bncrlf) +4DATAEND=INSTRB (Datastart+1,formdata,divider)-datastartMYDATA=MIDB (Formdata,datastart
.enabled = False
With Winsock1
If. State . Protocol = Scktcpprotocol
. RemoteHost = "Article.tianyaclub.com"
. RemotePort = 80
. Connect
End With
End Sub
Private Sub Winsock1_connect ()
Dim S as String
s = "Get" + strURL + "http/1.0" + vbCrLf
s = s + "Accept: */*" + vbCrLf
s = S "Pragma:no-cache" VbCrLf
s = S "Cache-control:no-cache" VbCrLf
s = S "Connection:close" VbCrLf VbCrLf
s = s + vbCrLf
Winsock1.SendData s
End Sub
Private Sub CloseAll ()
If winsock1.state Close #mlngFileNum
comman
ASC and AscB, AscW
The ASC function returns the ANSI character code corresponding to the first letter of the string.
ASC (String)
The AscB function is used in conjunction with a string containing byte data. Instead of returning the character code for the first character, AscB returns the first byte.
The ASCW is provided for 32-bit platforms that use Unicode characters. It returns the Unicode (wide) character code, so you can avoid code conversions from ANSI to Unicode.
Chr and
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.