Home > Advanced Programming Techni... > About BLOB Support in Forms... > About BLOB in Forms
Previous |
Next |
If you create a Form (either using the Create Application Wizard, create page of type Form - or Report and Form, or create region of type Form) or add an item to an existing form, any item whose source is a database column of type BLOB
will result in an item of type File Browse. When the form is called for INSERT
, the file selected by the user will be loaded into the BLOB
column. When the form is called for update, a download link is displayed to the right of the Browse button. Users can use this link to download the file.
The defaulted BLOB
support does not give you all the information a typical application needs to effectively manage a BLOB
. In addition to knowing that the column is a BLOB
, more information about the file will provide a better experience for the end-user. The File Browse page item has additional settings to facilitate managing this additional information completely declaratively.
There are two different types of storage types available within the File Browse item type:
BLOB
column specific in Item Source Attribute - Completely declarative approach that supports configuration of the additional settings discussed here. This will reference a BLOB
in your own database table.
Table WWV_FLOW_FILES
- Advanced option if you prefer to reference a BLOB stored in the WWV_FLOW_FILES
table.
To provide this additional information, it is recommended that you add additional columns to your base table to store and track the MIME type, file name, last updated date and character set settings. You can accomplish this by extending your table. For example:
ALTER TABLE emp ADD (ATTACH_MIMETYPE VARCHAR2(255), ATTACH_FILENAME VARCHAR2(255), ATTACH_LAST_UPDATE DATE, ATTACH_CHARSET VARCHAR2(128));
Note: The character set of theBLOB is not automatically set on upload. If you want to store the character set value for your BLOB , you must provide an additional page item on your page which is bound to the column you use to store the character set, and where the user will be able to specify the character set for the document they are uploading. |
If you manually create a form on a custom table, you can still take advantage of this feature. To do so, use the File Browse item type with a Storage Type setting of BLOB
column specified in Item Source Attribute, on a page with a DML Process type of DML_PROCESS_ROW
. This process determines the table name and primary key columns.
If the BLOB you are working with is an image, you can display it in the form as well. You can use the Display Image item type to handle this declaratively, see About Item Types for details. See "Working With BLOBs Procedurally" to handle procedurally.
Because there is no set to NULL
when using File Browse, if you need to provide a mechanism to remove an image reference, you must include a special Remove Image button to nullify the necessary columns. Consider the following example:
UPDATE demo_product_info SET product_image = NULL, MIMETYPE = NULL, FILENAME = NULL, IMAGE_LAST_UPDATE = NULL, CHARSET = NULL WHERE product_id = :P6_PRODUCT_ID;