WebPagePostFile Function

Action

Posts binary data to the Web server by means of the HTTP POST method. If the optional form for the query string includes a random variable, this function selects a new random value each time the form is posted. If the retrieved document is of content-type HTML, it is parsed and embedded documents are retrieved.

Instead of ASCII-encoded form content, binary data may be sent using this post function. The Content-Length header is automatically 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 function to convert the data to 6-bit ASCII characters.

Include file

WebAPI.bdh

Syntax

WebPagePostFile( in sUrl     : string,
                 in sFile    : string,
                 in sContent : string optional,
                 in sTimer   : string optional,
                 in formUrl  : form optional ): boolean;

Return value

  • true if the page is downloaded successfully

  • false otherwise

Parameter Description
sUrl Absolute URL to the document on the server. All characters that are part of the query string are not URL-encoded.
sFile File to post to the server.
sContent Content type string used in the request, for example, "image/gif" (optional).
sTimer Name of the timer used for page measurements (optional). If this parameter is omitted, no measurements are performed.
formUrl Form identifier used in the dclform section (optional). The expanded form is added to the URL after the "?".

Example

dcltrans
  transaction TWebPagePostFile
  var
    sFile: string;
  begin
    sFile := "c:\\temp\\dummyfile.txt";
    WebPagePostFile("http://standardhost/data2html.asp",
    sFile, "text/plain", "Dummy Timer", FORM_01);
  end TWebPagePostFile;

dclform
  FORM_01:
    "SessionID" := "SID12345";