This section describes BLOB support in forms.
If you create a form using the Create Application Wizard, create a page of type of Form or Report and Form, create a region of type Form, or add an item to an existing form, any item whose source is a database column of type
BLOB results in an item of type File Browse. When the form is called for
INSERT, the file selected by the user is 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.
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 provides a better experience for the end-user. The File Browse page item has additional settings to facilitate managing this additional information completely declaratively.
For more information on File Browse settings, see File Browse in "About Item Types."
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 references a
BLOB in your own database table.
WWV_FLOW_FILES - Available for backwards compatibility. Oracle does not recommend using this in new applications.
APEX_APPLICATION_TEMP_FILES - Store the uploaded file in a temporary location that you can access with the view
APEX_APPLICATION_TEMP_FILES. Oracle Application Express automatically deletes the file at the end of the session or at the end of the upload request, depending on what you choose for Purge File At.
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));
The character set of the
BLOB is not automatically set on upload. 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.
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;