传到服务器时会出现错误,但用WEB传不会出现.
请前辈帮我修正以下代码:
Dim blnConnected As BooleanPrivate Sub Command1_Click()
    
    If blnConnected Then Exit Sub
    
    Dim postSize As Long
    Dim postData As String
    Dim postHeader As String
    Dim strHttp As String
    
    filePath = "C:\ddd.EXE"
    fileContent = GetFileContents(filePath)
    
    '测试
    postData = "-----------------------------7d6251223700b8" & vbCrLf
    postData = postData & "Content-Disposition: form-data; name=""image1""; filename=""" & filePath & """" & vbCrLf
    postData = postData & "Content-Type: application/octet-stream" & vbCrLf & vbCrLf
    postData = postData & fileContent & vbCrLf
    
    
    postData = postData & "-----------------------------7d6251223700b8" & vbCrLf
    postData = postData & "Content-Disposition: form-data; name=""submit""" & vbCrLf & vbCrLf
    
    postData = postData & "submit" & vbCrLf
    postData = postData & "-----------------------------7d6251223700b8--" & vbCrLf & vbCrLf
    
    postSize = Len(postData)
    'MsgBox postSize
    
    postHeader = "POST /test/imageupload.asp HTTP/1.1" & vbCrLf
    postHeader = postHeader & "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
    postHeader = postHeader & "Referer: http://127.0.0.1/imageupload.htm" & vbCrLf
    postHeader = postHeader & "Accept-Language: zh-cn" & vbCrLf
    postHeader = postHeader & "Content-Type: multipart/form-data; boundary=---------------------------7d6ab313700b8" & vbCrLf
    postHeader = postHeader & "UA -CPU: x86" & vbCrLf
    postHeader = postHeader & "Accept-Encoding: gzip , deflate" & vbCrLf
    postHeader = postHeader & "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; Maxthon; .NET CLR 1.1.4322; icast 0.1214)" & vbCrLf
    postHeader = postHeader & "Host: 127.0.0.1" & vbCrLf
    postHeader = postHeader & "Content-Length: " & postSize & vbCrLf
    postHeader = postHeader & "Connection: Keep-Alive" & vbCrLf
    postHeader = postHeader & "cache-Control: no-cache" & vbCrLf
    postHeader = postHeader & "Cookie: ASPSESSIONIDQADCDABC=MCHJBLEBMBBHMOELCOAKICDO" & vbCrLf & vbCrLf
    
    strHttp = postHeader & postData    Winsock1.Protocol = sckTCPProtocol
    Winsock1.RemoteHost = "www.0069.cn"
    Winsock1.RemotePort = 80
    ' make the connection and send the HTTP request
    Winsock1.Connect
    
    While Not blnConnected
        DoEvents
    Wend
    
    txtRequest.Text = strHttp
    Winsock1.SendData strHttp
    
End SubPrivate Function GetFileContents(ByVal strPath As String) As String
    Dim StrReturn As String
    Dim lngLength As Long
    
    lngLength = FileLen(strPath)
    StrReturn = String(lngLength, Chr(0))
    
    On Error GoTo ERR_HANDLER
    
    Open strPath For Binary As #1
    
    Get #1, , StrReturn
    
    GetFileContents = StrReturn
    
    Close #1
    
    Exit Function
    
ERR_HANDLER:
    MsgBox Err.Description, vbCritical, "ERROR"
    
    Err.Clear
End Function