Private Sub Command1_Click()    '下面是我的代码    CommonDialog.ShowOpen
    
    localFilePath = CommonDialog.FileName
    
    RemoteHost = "localhost"
    
    RemotePort = 80
    
    RemoteUploadPage = "/test/WebForm1.aspx"
    
    winSock.RemoteHost = RemoteHost
    
    winSock.RemotePort = RemotePort
    
    winSock.Connect
  
    
    DoEvents
    
    tmr = Timer
    
    Do Until winSock.state = 7
    
        DoEvents
        
        If Timer - tmr >= 10 Then
        
            MsgBox "Connection     Timeout. ", vbOKOnly, "Error"
            
            winSock.Close
            
            Exit Sub
        End If
    Loop
    
  
    strhttpheader = strhttpheader & "POST " & RemoteUploadPage & " HTTP/1.1" & vbCrLf
    strhttpheader = strhttpheader & "Accept:   image/gif,   image/x-xbitmap,   image/jpeg,   image/pjpeg,   application/x-shockwave-flash,   application/vnd.ms-excel,   application/vnd.ms-powerpoint,   application/msword,   */*" & vbCrLf
    strhttpheader = strhttpheader & "Referer: http://" & RemoteHost & RemoteUploadPage & "?" & localFilePath & vbCrLf
    strhttpheader = strhttpheader & "Accept-Language:   zh-cn" & vbCrLf
    strhttpheader = strhttpheader & "Content-Type:   multipart/form-data;   boundary=---------------------------7d32b5e2406c6" & vbCrLf
    strhttpheader = strhttpheader & "Accept-Encoding:   gzip,   deflate" & vbCrLf
    strhttpheader = strhttpheader & "Host: " & RemoteHost & ":" & RemotePort & vbCrLf
    strhttpheader = strhttpheader & "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; InfoPath.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)" & vbCrLf
    
    
    strbody = strbody & "-----------------------------7d32b5e2406c6" & vbCrLf
    strbody = strbody & "Content-Disposition:   form-data;   name=""upLoadFile"";   filename=""" & localFilePath & """" & vbCrLf
    strbody = strbody & "Content-Type:   text/plain" & vbCrLf
    strbody = strbody & "" & vbCrLf & vbCrLf
    
   
   
    strbody2 = "-----------------------------7d32b5e2406c6--"
    
   
    
    strhttpheader = strhttpheader & "Content-Length: " & CLng(Len(strbody) + Len(strbody2) + FileLen(localFilePath)) & vbCrLf
    
   
    strhttpheader = strhttpheader & "Connection: Keep-Alive" & vbCrLf
    strhttpheader = strhttpheader & "Cache-Control: no-cache" & vbCrLf & vbCrLf
    
    
    
    winSock.SendData strhttpheader & strbody
    
    DoEvents
   
    Dim bytBuff(90000)     As Byte
    
    Dim bytRem()     As Byte
    
    Open localFilePath For Binary As #1
    
    times = Int(LOF(1) / 90000)
    
    ReDim bytRem(LOF(1) Mod 90000 - 1)
   
    For i = 1 To times
    
        Get #1, , bytBuff
        
        winSock.SendData bytBuff
        
        DoEvents
        
    Next
    
    Get #1, , bytRem
    
    winSock.SendData bytRem
    
    DoEvents
    
    Close #1
    
    
    
    winSock.SendData vbCrLf & strbody2
    
    DoEvents
   
    
    winSock.Close
End Sub而且好像winsock传3M以上的文件就会报40006错......求解啊