关于文件上传组件的调试问题

80酷酷网    80kuku.com

  上传|问题这是我的上传组件原文,vb作的,没有任何问题!



   Public Bin

Private Names()

Private Sizes()

Private Filenames()

Private Myposition()

Public Maxsize

Public Fcount



Public Sub Exec()

   Dim Pstart, Pend, strBoundary, i, Str, Position

   Dim Spacestr

   Spacestr = "-----------------------------"

   Dim tempbarray, tempstr

   tempstr = BtoS(Bin)

   strBoundary = "Content-Disposition: form-data"

   tempbarray = Split(tempstr, strBoundary)

   Fcount = UBound(tempbarray)

   

   ReDim Names(Fcount)

   ReDim Sizes(Fcount)

   ReDim Filenames(Fcount)

   ReDim Myposition(Fcount, 2)

   

   strBoundary = StoB(strBoundary)

   Position = InStrB(Bin, strBoundary) + 1

   

   For i = 0 To Fcount - 1

     Pstart = InStrB(Position, Bin, StoB(Chr(34))) + 1

     Pend = InStrB(Pstart, Bin, StoB(Chr(34)))

     Names(i) = BtoS(MidB(Bin, Pstart, Pend - Pstart))

     '以上取表单名

     

     Pstart = Pend + 1

     Str = MidB(Bin, Pstart, 15)

     Position = InStrB(Str, StoB("filename"))

     If Position > 0 Then

       Pstart = InStrB(Pstart, Bin, StoB(Chr(34))) + 1

       Pend = InStrB(Pstart, Bin, StoB(Chr(34)))

       Str = BtoS(MidB(Bin, Pstart, Pend - Pstart))

       If Str = Empty Then

         Filenames(i) = ""

       Else

         Filenames(i) = Str

         Pstart = InStrB(Pend, Bin, StoB(vbCrLf & vbCrLf)) + 4

         Pend = InStrB(Pstart, Bin, StoB("-------")) - 2

         Myposition(i, 0) = Pstart

         Myposition(i, 1) = Pend

       End If

     Else

       Pstart = InStrB(Pstart, Bin, StoB(vbCrLf & vbCrLf)) + 4

       Pend = InStrB(Pstart, Bin, StoB("-------")) - 2

       Myposition(i, 0) = Pstart

       Myposition(i, 1) = Pend

     End If

     Position = Pend

   Next



分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: