$Web Put Binary: Difference between revisions

From m204wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 41: Line 41:
</p>
</p>


<b>Note:</b> Another way to send binary data is to store it in a ''Model 204'' procedure and send it to the client using <var>[[$Web_ProcSend]]</var>.
<b>Note:</b> Another way to send binary data is to store it in a <var class="product">Model 204</var> procedure and send it to the client using <var>[[$Web_ProcSend]]</var>.


[[Category:Janus Web Server $functions|$Web_Put_Bin, $Web_Put_Binary]]
[[Category:Janus Web Server $functions|$Web_Put_Bin, $Web_Put_Binary]]

Revision as of 19:09, 16 June 2012

<section begin="desc" />$Web_Put_Binary: Add binary string to response buffer<section end="desc" />

$Web_Put_Binary sends a binary string to the client buffer.

Note: $Web_Put_Bin is a synonym for the $Web_Put_Binary function.

$Web_Put_Bin is a callable $function (see "Calling Sirius Mods $functions").

$Web_Put_Bin takes a single required string argument and returns a status code.

Syntax

<section begin="syntax" />%rc = $Web_Put_Binary( bin_string ) <section end="syntax" />

%rc A numeric variable to contain the returned status code.
bin_string A "binary" string that is added to the client buffer without any translation. Since the client buffer is always sent to the browser without translation, the binary contents of bin_string will be received by the browser. Under Sirius Mods Version 6.7 and later, $Web_Put_Bin is longstring capable: it can send a longstring with a length greater than 255 bytes.

These are the $Web_Put_Bin return codes:

Code Meaning
0 Binary string sent to the client buffer
-1 Invalid call, not a Web thread
-4 Missing argument

This sample shows a binary image in .jpg format being sent from a %variable to the client buffer (the image would have to be pretty small, given the 255 byte limitation on %variables):

%X = $Web_Type('binary/jpeg') %X = $Web_Put_Bin( %companyx_logo ) Stop

Note: Another way to send binary data is to store it in a Model 204 procedure and send it to the client using $Web_ProcSend.