login about faq

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

asked May 03 '16 at 07:51

davesiracusa's gravatar image


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.


answered May 03 '16 at 08:10

chilkat's gravatar image

chilkat ♦♦

I simply set it, because it's always 0 server-side.

(May 03 '16 at 08:22) davesiracusa

If I pass an empty string in PText for the content type. Set resp = http.PText("POST", sURL, sPostData, "UTF-8", "", 0, 0) I see the postdata in the log, however the ASP.NET app can't parse it.
If I set it to multipart/form-data, or multipart/form-data;boundary... no postdata is sent.

(May 03 '16 at 08:41) davesiracusa

BTW - I removed the http.AddQuickHeader "Content-Length", Str(Len(sPostData)) earlier.

(May 03 '16 at 08:43) davesiracusa

How do I format the postData when calling the following? Set resp = http.PText("POST", sURL, sPostData, "", "multipart/form-data", 0, 0)

(May 03 '16 at 09:28) davesiracusa

I tried PostUrlEncoded, it sends the post form data, however the passed query parameter doesn't get to the ASP.NET page. The same URL for PText, does pass the query parameter.

(May 03 '16 at 09:50) davesiracusa

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


answered May 03 '16 at 10:12

chilkat's gravatar image

chilkat ♦♦

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported



Asked: May 03 '16 at 07:51

Seen: 1,692 times

Last updated: May 03 '16 at 10:12

powered by OSQA