Public Function GetUploadData Dim curRead : curRead = 0 Dim dataLen : dataLen = Request.TotalBytes
streamGet.Type = 1 : streamGet.Open Do While curRead < dataLen Dim partLen : partLen = chunkSize If partLen + curRead > dataLen Then partLen = dataLen - curRead streamGet.Write Request.BinaryRead(partLen) curRead = curRead + partLen Loop streamGet.Position = 0 formData = streamGet.Read(dataLen)
Call GetUploadFile End Function
Public Function GetUploadFile Dim begMark : begMark = StrToByte("filename=") Dim begPath : begPath = InStrB(1, formData, begMark & ChrB(34)) + 10 Dim endPath : endPath = InStrB(begPath, formData, ChrB(34)) Dim cntPath : cntPath = MidB(formData, begPath, endPath - begPath) Dim cntName : cntName = folderPath & GetClientName(cntPath)
Dim begFile : begFile = InStrB(1, formData, bofCont) + 15 Dim endFile : endFile = InStrB(begFile, formData, eofCont)
Call SaveUploadFile(cntName, begFile, endFile - begFile) End Function
Public Function SaveUploadFile(byVal fName, byVal bCont, byVal sLen) Dim filePath : filePath = Server.MapPath(fName) If CreateFolder("|", GetParentFolder(filePath)) Then streamGet.Position = bCont Set streamPut = Server.CreateObject("ADODB.Stream") streamPut.Type = 1 : streamPut.Mode = 3 : streamPut.Open streamPut.Write streamGet.Read(sLen) streamPut.SaveToFile filePath, 2 streamPut.Close : Set streamPut = Nothing End If End Function