replyAsBinary

replyAsBinary(header:  String;
              message: Binary): String;

The replyAsBinary method of the Form class returns the Binary message contained in the message parameter to the web browser without modification. Use this method to send a binary reply without UTF-8 encoding to a web message.

The message uses the String value in the header parameter as the HTTP headers. The headers are encoded with UTF-8, as is expected for HTTP headers.

The code fragment in the following example shows the use of the replyAsBinary method in the MyWebForm class.

message := f.readBinary(f.fileLength);
header := 'Content-Type: application/pdf' & CrLf &
          'Content-Disposition: attachment;filename=' & 
                              downloadFile.fileName.stripToFileName & CrLf &
          'Content-Length: ' & message.length.String & CrLf & CrLf;
replyAsBinary(header, message);