Upload ' Upload.asp
Function Intmin (n,y)
If NIntmin=int (N)
ElseIf y>0 Then
Intmin=int (y)
Else
Intmin=n
End If
End Function
Function Getformvalue (Name)
Dim Formsize,formdata,dataheader,datastart,dataend,formnamestart,formnameend,formname,firstfilter
Formsize=request.totalbytes ()
Formdata=request.binaryread (Formsize)
Firstfilter=true
For I=1 to Len (Name)
TMP=TMPAMP;CHRB (AscB) (Mid (name,i,1))
Next
Name=tmp
Dataend=0
Datastart=0
Do While formsiz
CopyCode The Code is as follows:
Sbase_64_characters = "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789 + /"Sbase_64_characters = strunicode2ansi (sbase_64_characters)
Function strunicodelen (ascontents)'Calculate the ANSI encoding length of the Unicode stringAscontents1 = "A" ascontentsLen1 = Len (ascontents1)K = 0For I = 1 to len1Asc1 = ASC (mid (ascontents1, I, 1 ))If asc1 If asc1> 255 thenK = K + 2ElseK = k + 1End ifNextStrunicodelen = K-1End Function
function strunic
, we know that the delimiter plays an important role in splitting multiple data segments (including text boxes and various types of files. As analyzed earlier, the delimiter appears before the first carriage return line break. Therefore, you can use the following program to obtain the delimiter code: Newline = chrb (13) chrb (10) 'newline indicates the binary carriage return.Filesize = request. totalbytes
Upload | No components I studied the no component upload, and made one of the simplest possible ways
----Use 9 lines of code to truly implement no component upload, how to say that spent half a day to write 9 lines of code is a bit of efficiency and results.
So I wrote this article.
Formsize=request.totalbytes ()
Formdata=request.binaryread (Formsize)
Dataheader=leftb (FORMDATA,INSTRB (FORMDATA,CHRB) AMP;CHRB
the delimiter plays an important role in splitting multiple data segments (including text boxes and various types of files. As analyzed earlier, the delimiter appears before the first carriage return line break. Therefore, you can use the following program to obtain the delimiter code:
Newline = chrb (13) chrb (10) 'newline indicates the binary carriage return.
Filesize = request. totalbytes 'filesize is
separator, but the text box and file forms slightly different, this can be analyzed by a specific binary code to understand.
3, using ASP technology to achieve file storage
Handling of uploading file code
1) Get the separator code
From the above analysis, we already know that a separator plays an important role in segmenting multiple data segments, including text boxes and various types of files. As previously analyzed, the separator appears before the first carriage return line symbol. Ther
storageHandling of uploaded file code1) Get the separator codeFrom the above analysis we already know that the separator plays an important role in splitting multiple data segments (including text boxes and various types of files). As previously analyzed, the separator appears before the first carriage return newline symbol. Therefore, the following procedure allows you to obtain the delimiter code:NEWLINE=CHRB (
keytemp as StringDim Key1 as Byte
for k = 1 to keytemp = keytemp CStr (Int (RND * (9) + 1)) Next Key1 = CByte (Mid (Keytemp, one, 1) Mid (Keytemp, 1)) for i = 1 to Len (strsource) Strchar = Mid (strsource, I, 1) ' Remove a character from the string to be encrypted Blowdata = AscB (MidB (Strchar, 1, 1)) Xor Key1 ' take characters of low byte and Key1 for XOR operation shigdata = AscB (MidB (Strchar, 2, 1)) ' Take the high byte of the character strencrypt
GBCODE2=ASCB (MidB (binstr,j+1,1))
a=gbcode1-h81
B=gbcode2-h40
If gbcode2>h7f Then b=b-1
Gbtou=gbtou ChrW (gb2u (a*190+b)) ' Gb2u for conversion tables
J=j+1
Else
Gbtou=gbtou ChrW (AscB (MidB (binstr,j,1))
End If
Next
End Function
' Get the boundary string
Boundary=mid (Request.ServerVariables ("Content_Type"), 31)
' Number of bytes of data in form
Bytecount=request.totalbytes
' Binary data in form
Binread=request.binaryread (ByteCount)
' Border ASCII string
ENDSTR=
' When the table dropdowns has both a text field and a file field, we must set the form's encoding type to the ' Multipart/form-data ' type
' This time, the encoded file uploaded does not directly remove the values of the text field and the binary data of the file field, which requires splitting the form field
' There is a random separator between each form field in the uploaded data stream, the delimiter is invariant in the same stream, and the different flow delimiters are unchanged.
' This de
, while the use of ordinary data, write workflow, the contents of the file directly to the file itself, the flow of the way, Solve the problem 2.
The code is as follows and is similar to transformation:
Server.ScriptTimeout = 600
Class Quickupload
Private Fform, Ffile, Upload_stream, Convertstream
Property Get Form
Set Form = Fform
End Property
Property Get File
Set File = Ffile
End Property
Private Sub Class_Initialize
Dim IStart, Iend, boundary, FieldName, FileName, ContentType, Itemvalue,
(binstr,j+1,1))
a=gbcode1-h81
B=gbcode2-h40
If gbcode2>h7f Then b=b-1
Gbtou=gbtou ChrW (gb2u (a*190+b)) ' Gb2u for conversion tables
J=j+1
Else
Gbtou=gbtou ChrW (AscB (MidB (binstr,j,1))
End If
Next
End Function
' Get the boundary string
Boundary=mid (Request.ServerVariables ("Content_Type"), 31)
' Number of bytes of data in form
Bytecount=request.totalbytes
' Binary data in form
Binread=request.binaryread (ByteCount)
' Border ASCII string
ENDSTR=CHRB
Call Com_creatvalidcode ("Validcode")
Sub Com_creatvalidcode (PSN)
' Author:layen
' qq:84815733
' E-mail:support@ssaw.net
' Disable caching
Response.Expires =-9999
Response.AddHeader "Pragma", "No-cache"
Response.AddHeader "Cache-ctrol", "No-cache"
Response.ContentType = "Image/bmp"
Randomize
Dim I, II, III
Const Codds = 8 ' Odds of occurrence of miscellaneous points
Const Camount = 36 ' text quantity
Const ccode = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
' Color data (character, background)
Dim V
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.