30.1 DOWNLOAD Procedure Signature 1

This procedure downloads a BLOB to the client.

Note:

Clears any previous output to the HTP buffer. APEX_APPLICATION.STOP_APEX_ENGINE is called after downloading the file.

Syntax

APEX_HTTP.DOWNLOAD (
    p_blob              IN OUT NOCOPY   BLOB,
    p_content_type      IN              VARCHAR2,
    p_filename          IN              VARCHAR2     DEFAULT NULL,
    p_is_inline         IN              BOOLEAN      DEFAULT FALSE )

Parameters

Parameter Description
p_blob The BLOB value to download.
p_content_type The mime type of the file.
p_filename Name of the file.
p_is_inline

If FALSE (default), the browser displays a file download dialog to save the file.

If TRUE, displays the file inline in the browser window.

Example

The following example downloads a file stored in a table.

DECLARE
    l_file           blob;
    l_content_type   varchar2( 4000 );
    l_filename       varchar2( 4000 );
BEGIN

    SELECT blob_content,
           mime_type,
           filename
      INTO l_file,
           l_content_type,
           l_filename
      FROM apex_application_temp_files
     WHERE name = :P1_FILE;

    apex_http.download(
        p_blob           => l_file,
        p_content_type   => l_content_type,
        p_filename       => l_filename );

END;