Posts binary data 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. In order to send binary data (octets) more safely over the Internet, use the WebBase64Encode to convert the data to 6-bit ASCII characters.
WebAPI.bdh
WebUrlPostBin( in sUrl : string, in sData : string, in nDataLen : number, in sContentType : string, in fWait : float optional ): boolean;
true if the worker thread posting the form content to the server could be started successfully
false otherwise
Parameter | Description |
---|---|
sUrl | Complete URL to the file on the server |
sData | Data to post to the server. This may be binary data. For posting all available binary data specify STRING_COMPLETE for nDataLength and use the bin() operator for sData (see example). |
nDataLen | Length in bytes of data contained in the buffer sData. Specify STRING_COMPLETE or omit this parameter to post all available data |
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 |
dcltrans transaction TWebFormPostBin var sBase64Encoded : string; nLen : number; sData : string; begin WebBase64Encode(sBase64Encoded, sizeof(sBase64Encoded), nLen, "name=Harry Smith&address=Elkenney Str. 26" "&phone=+43223344", 57); WebUrlPostBin("http://standardhost/data2html.asp", sBase64Encoded, STRING_COMPLETE, "text/html"); WebUrlPostBin("http://standardhost/data2html.asp", bin(sData), STRING_COMPLETE, "application/octet-stream"); end TWebFormPostBin;
WebFileUpload01.bdf, WebForms02.bdf, WebPost01.bdf