WebUrlPostFile Function

Action

Posts binary data, stored in a file, to the Web server by means of the HTTP POST method. Instead of ASCII-encoded 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.

Include file

WebAPI.bdh

Syntax

WebUrlPostFile( in sUrl         : string,
                in sFile        : string,
                in sContentType : string,
                in fWait        : float optional ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
sUrl Complete URL to the file on the server.
sFile File containing the data, which should be posted 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). Default value is 0.0.

Example

dcltrans
  transaction TWeb
  var
    sFile : string;
  begin
    sFile := "c:\\temp\\dummyfile.txt";
    WebUrlPostFile("http://standardhost/data2html.asp", sFile, "text/plain");
  end TWeb;