DIM DATA_5XSOFT
Class Upload_5xsoft Dim Objform, Objfile, Version
Public Function Form (Strform) Strform = LCase (Strform) if not objform.exists (strform) Then form = "" Else form = objform (strform) end if end function
Public function file (strfile) strfile = lcase (strfile) if not objfile.exists (strfile) THEN SET FILE = New fileInfo else set file = objfile (strfile) end if End Function
Private Sub Class_Initialize dim RequestData, sStart, vbCrlf, sInfo, iInfoStart, iInfoEnd, tStream, iStart, theFile dim iFileSize, sFilePath, sFileType, sFormValue, sFileName dim iFindStart, iFindEnd dim iFormStart, iFormEnd, sFormName dim dataend, Image, head_height_l, head_height_h, head_width_l, head_width_h, jpgwidth, jpgheight Version = "Transformation HTTP upload program Version 2.0" set objForm = Server.CreateObject ( "Scripting.Dictionary") set objFile = Server.CreateObject ( "Scripting.Dictionary") if Request.TotalBytes <1 then Exit Sub set tStream = Server.CreateObject ( "adodb.stream") set Data_5xsoft = Server.CreateObject ( "adodb.stream") Data_5xsoft.Type = 1 Data_5xsoft.Mode = 3 Data_5xsoft.Open Data_5xsoft.Write Request.BinaryRead (Request. Totalbytes) DATA_5XSOFT.POSITION = 0 RequestData = DATA_5XSOFT.READ
iFormStart = 1 iFormEnd = LenB (RequestData) vbCrlf = chrB (13) & chrB (10) sStart = MidB (RequestData, 1, InStrB (iFormStart, RequestData, vbCrlf) -1) iStart = LenB (sStart) iFormStart = iFormStart iStart 1 while (iFormStart 10)
HEAD_WIDTH_H = Head_Width_H * 256
Obtain the file name iFindStart head_height_h = head_height_h * 256 jpgwidth = head_width_h head_width_l jpgheight = head_height_h head_height_l '= InStr (iFindEnd, sInfo, "filename =" "", 1) 10 iFindEnd = InStr (iFindStart, sInfo, "" "" , 1) sFileName = Mid (sinfo, iFindStart, iFindEnd-iFindStart) theFile.FileName = getFileName (sFileName) theFile.FilePath = getFilePath (sFileName) 'to obtain the file type iFindStart = InStr (iFindEnd, sInfo, "Content-type:", 1) 14 iFindEnd = InStr (iFindStart, sInfo, vbCr) theFile.FileType = Mid (sinfo, iFindStart, iFindEnd-iFindStart) theFile.FileStart = iInfoEnd theFile.FileSize = iFormStart -iInfoEnd -3 theFile.FormName = sFormName theFile.image = dataend theFile.JpgWidth = jpgwidth theFile.JpgHeight = jpgheight if not objFile.Exists (sFormName) then objFile.add sFormName, theFile end if else 'form if the project tStream.Type = 1 tStream.Mode = 3 tStream.Open Data_5xsoft. Position = IInfoend Data_5xsoft.copyto TSTREAM, IFORMSTART-IINFOEND-3 TSTREAM.POSITION = 0 TSTREAM.TYPE = 2 TSTREAM .Charset = "gb2312" sFormValue = tStream.ReadText tStream.Close if objForm.Exists (sFormName) then objForm (sFormName) = objForm (sFormName) & "," & sFormValue else objForm.Add sFormName, sFormValue end if end if iFormStart = iFormStart iStart 1 Wend RequestData = "" SET TSTREAM = Nothingend Sub
Private Sub Class_Terminate if Request.TotalBytes> 0 then objForm.RemoveAll objFile.RemoveAll set objForm = nothing set objFile = nothing Data_5xsoft.Close set Data_5xsoft = nothing end ifEnd Sub Private function GetFilePath (FullPath) If FullPath <> "" Then GetFilePath = left (FullPath, InStrRev (FullPath, "/")) Else GetFilePath = "" End If End function Private function GetFileName (FullPath) If FullPath <> "" Then GetFileName = mid (FullPath, InStrRev (FullPath, "/") 1 ) Else GetFileName = "" End If End functionEnd ClassClass FileInfo dim FormName, FileName, FilePath, FileSize, FileType, FileStart, JpgWidth, JpgHeight, image Private Sub Class_Initialize FileName = "" FilePath = "" FileSize = 0 FileStart = 0 FormName = " "FileType =" "JpgWidth = 0 JpgHeight = 0 image = 0 End Sub Public function SaveAs (fullPath) dim dr, ErrorChar, i SaveAs = true if trim (fullpath) =" "or FileStart = 0 or FileName =" "or right (Fullpath, 1) = "/" THEN EXIT FUNCTION SET DR = CREA teObject ( "Adodb.Stream") dr.Mode = 3 dr.Type = 1 dr.Open Data_5xsoft.position = FileStart Data_5xsoft.copyto dr, FileSize dr.SaveToFile FullPath, 2 dr.Close set dr = nothing SaveAs = false end function END CLASS script>