Try OpenEdge Now
skip to main content
Developing WebSpeed Applications
Controlling WebSpeed Transactions : Handling Binary Large Objects (BLOBs)
 

Handling Binary Large Objects (BLOBs)

A binary large object (BLOB) contains unstructured data and consists of a group of bytes. ABL has no special knowledge about its contents. Rather, ABL assumes that the data in a BLOB is managed by other software (such as a word processor, a spreadsheet program, or a bar-code reader).
In the ABL, a BLOB is a data type used to specify a database table or temp-table field that contains a BLOB locator, which points to the associated BLOB data stored in the database. You must use a MEMPTR to manipulate the binary contents of a BLOB field in ABL.
WebSpeed applications can upload BLOBs and include them in their output.
To protect your system from malicious code, you should not allow unrestricted processing of uploaded binary files. Therefore, WebSpeed does not automatically store any file uploaded as part of a Web request. Uploaded files are held in memory. Your application can then manipulate the file through a MEMPTR.
The following code is an example of how to create a form that can upload a BLOB specified as a file:
<HTML>
<BODY>
<FORM ENCTYPE="multipart/form-data"
ACTION="http://yourhost/msngr_path/msngr/target_app" METHOD="POST">
<INPUT type="file" name="attachment1"> <INPUT type="submit">
</FORM>
</BODY>
</HTML>
To enable a WebSpeed application to accept data from this form, you must do the following:
*Verify that the WebSpeed Messenger is from OpenEdge 10.1A or a later release. The Messengers in previous versions cannot accept BLOBs.
*Specify a maximum size for uploaded files.
*Write code to manipulate the uploaded file through its MEMPTR. This code should ensure that the uploaded file contains no malicious content before it is stored to disk. WebSpeed provides a new API function to return the file's MEMPTR. See get-binary-data for the API's description.
* Specifying maximum size of uploaded files