日期:2012-12-31  浏览次数:20893 次

这是我的上传组件原文,vb作的,没有任何问题!<br>
<br>
   Public Bin<br>
Private Names()<br>
Private Sizes()<br>
Private Filenames()<br>
Private Myposition()<br>
Public Maxsize<br>
Public Fcount<br>
<br>
Public Sub Exec()<br>
   Dim Pstart, Pend, strBoundary, i, Str, Position<br>
   Dim Spacestr<br>
   Spacestr = "-----------------------------"<br>
   Dim tempbarray, tempstr<br>
   tempstr = BtoS(Bin)<br>
   strBoundary = "Content-Disposition: form-data"<br>
   tempbarray = Split(tempstr, strBoundary)<br>
   Fcount = UBound(tempbarray)<br>
   <br>
   ReDim Names(Fcount)<br>
   ReDim Sizes(Fcount)<br>
   ReDim Filenames(Fcount)<br>
   ReDim Myposition(Fcount, 2)<br>
   <br>
   strBoundary = StoB(strBoundary)<br>
   Position = InStrB(Bin, strBoundary) + 1<br>
   <br>
   For i = 0 To Fcount - 1<br>
     Pstart = InStrB(Position, Bin, StoB(Chr(34))) + 1<br>
     Pend = InStrB(Pstart, Bin, StoB(Chr(34)))<br>
     Names(i) = BtoS(MidB(Bin, Pstart, Pend - Pstart))<br>
     '以上取表单名<br>
     <br>
     Pstart = Pend + 1<br>
     Str = MidB(Bin, Pstart, 15)<br>
     Position = InStrB(Str, StoB("filename"))<br>
     If Position > 0 Then<br>
       Pstart = InStrB(Pstart, Bin, StoB(Chr(34))) + 1<br>
       Pend = InStrB(Pstart, Bin, StoB(Chr(34)))<br>
       Str = BtoS(MidB(Bin, Pstart, Pend - Pstart))<br>
       If Str = Empty Then<br>
         Filenames(i) = ""<br>
       Else<br>
         Filenames(i) = Str<br>
         Pstart = InStrB(Pend, Bin, StoB(vbCrLf & vbCrLf)) + 4<br>
         Pend = InStrB(Pstart, Bin, StoB("-------")) - 2<br>
         Myposition(i, 0) = Pstart<br>
         Myposition(i, 1) = Pend<br>
       End If<br>
     Else<br>
       Pstart = InStrB(Pstart, Bin, StoB(vbCrLf & vbCrLf)) + 4<br>
       Pend = InStrB(Pstart, Bin, StoB("-------")) - 2<br>
       Myposition(i, 0) = Pstart<br>
       Myposition(i, 1) = Pend<br>
     End If<br>
     Position = Pend<br>
   Next<br>
<br>