WebFormPostFile Function


Posts binary data to the Web server by means of the HTTP POST method. If the form includes a random variable, this function selects a new random value each time the form is posted.

Instead of ASCII-encoded form content, binary data may be sent using this post function. The Content-Length header will automatically be added to the request. The appropriate Content-Type has to be specified. In order to send binary data (octets) more safely over the Internet, use the WebBase64Encode to convert the data to 6-bit ASCII characters.

Include file



WebFormPostFile( in sUrl         : string,
                 in formUrl      : form,
                 in sFile        : string,
                 in sContentType : string,
                 in fWait        : float optional): boolean;

Return value

  • true successful.

  • false otherwise.

Parameter Description
sUrl Complete URL to the file on the server
formUrl Form identifier used in the dclform section (see example below). The expanded form is added to the URL after the "?".
sFile File to post to the server.
sContentType Content type string used in the request, for example, "image/gif"
fWait Minimum time or minimum mean time that this function call has to last (optional). The default value is 0.0

The form content in the dclform section is represented in an unencoded format to enhance readability and customizability. The data gets URL encoded on form submission. There are two possibilities to send data unencoded:

  • Add the query string as it should be sent to the server directly to the URL, for example, "http://www.comp.com/cgi/special?<don't>;[encode]/this". Note that blanks are encoded when this method is used.

  • Use WebUrlPostBin to post data as provided to the Web server.


  transaction TWebFormPostFile
    sFile: string;
    sFile := "c:\\temp\\dummyfile.txt";
    WebFormPostFile("http://standardhost/data2html.asp", FORM_01,
    sFile, "text/plain", 0.0);
  end TWebFormPostFile;

    "SessionID" := "SID12345";