日期:2010-11-06  浏览次数:20709 次

<%
    Class Upload
        Public  Form, Finished
        Private bVBCrlf, bSeparate, formData, cFields, folderPath, itemCount, sErrors, sAuthor, sVersion
        Private itemStart(), itemLength(), dataStart(), dataLength(), itemName(), itemData(), extenArr()

        Private Sub Class_Initialize     
            formData = Request.BinaryRead(Request.TotalBytes)
            Set Form = Server.CreateObject("Scripting.Dictionary")
            sAuthor = "51JS.COM-ZMM"
            sVersion = "Upload Class 1.0"
        End Sub
       
        Public Property Get ErrMessage
            ErrMessage = sErrors
        End Property
 
        Public Property Get Author
            Author = sAuthor
        End Property

        Public Property Get Version
            Version = sVersion
        End Property

        Public Property Let CheckFields(byVal sCheck)
            cFields = sCheck
        End Property

        Public Property Let Folder(byVal sFolder)
            folderPath = sFolder
        End Property

        Public Function Start
            Finished = False
            bVBCrlf = StrToByte(vbCrlf & vbCrlf)
            bSeparate = StrToByte("-----------------------------")
            itemCount = 0
            sErrors = ""
            Call ItemPosition
        End Function

        Private Function ItemPosition
            Dim iStart, iLength : iStart = 1       
            Do Until InStrB(iStart, formData, bSeparate) = 0
               iStart = InStrB(iStart, formData, bSeparate) + LenB(bSeparate) + 14
               iLength = InStrB(iStart, formData, bSeparate) - iStart - 2
               If Abs(iStart + 2 - LenB(formData)) > 2 Then
                  ReDim Preserve itemStart(itemCount)
             &n