Archived Forum Post

Index of archived forum posts


The post data isn't getting to the ASP.NET page.

May 03 '16 at 10:12

The content-length is 0.

    Dim resp As ChilkatHttpResponse
    http.AddQuickHeader "Content-Type", "multipart/form-data; boundary=" & sBoundary

    http.AddQuickHeader "Pragma", "no-cache"
    http.AddQuickHeader "Content-Length", Str(Len(sPostData))
    http.AddQuickHeader "Accept", "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*"
    http.AddQuickHeader "Host", "MRO-PC-201"

    http.AddQuickHeader "User-Agent", "Chilkat URL Control"

    http.AddQuickHeader "Connection", IIf(bKeepAlive, "Keep-Alive", "close")

    Set resp = http.PText("POST", sURL, sPostData, "UTF-8", "", 0, 0)

    If (resp Is Nothing) Then
        OutputDebugString "$$$BUpload.Upload, Called chilkat http, resp in nothing"
        OutputDebugString "$$$BUpload.Upload, Called chilkat http, resp.StatusCode: " & 
        OutputDebugString "$$$BUpload.Upload, Called chilkat http, resp.BodyStr: " & 
    End If


Connection: close Pragma: no-cache Content-Length: 0 Content-Type: multipart/form-data; boundary=---------------------------8dccc3035047a0; boundary=------------020009050006070508010404 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, / Accept-Encoding: gzip Accept-Language: en-us,en;q=0.5 Host: MRO-PC-201 User-Agent: Chilkat URL Control

If I include: http.AddQuickHeader "Custom-Length", Str(Len(sPostData)) I see: Custom-Length: 582


You should never be setting the Content-Length header -- Chilkat automatically sets it based on the actual length of the content sent.

To see what happened, set the http.SessionLogFilename property. Also, turn on verbose logging (http.VerboseLogging = 1) and examine the http.LastErrorTExt.


Dave, see this example. (I'm not sure of your programming language, so I'm providing several links..)

VBScript: HTTP multipart/form-data Upload

Visual Basic 6.0: HTTP multipart/form-data Upload

Visual FoxPro: HTTP multipart/form-data Upload