Edit D:\app\Administrator\product\11.2.0\dbhome_1\apex\images\doc\tutorial\up_dn_files.htm
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <!-- Run date = February 23, 2005 16:58:38 --> <meta name="Generator" content=" Oracle DARB XHTML converter - Version 4.1.3 Build 116" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <title> How to Upload and Download Files in an Application</title> <link rel="stylesheet" type="text/css" href="blafdoc.css" title="default" /> <link rel="stylesheet" type="text/css" href="darbbook.css" title="default" /> <link rel="prev" href="bar_chart.htm" title="Previous" /> <link rel="next" href="javascript.htm" title="Next" /> <link rel="up" href="toc.htm" title="Up" /> <link rel="contents" href="toc.htm" title="Contents" /> <link rel="copyright" href="./support/html/cpyr.htm" title="Copyright" /> <link rel="index" href="index.htm" title="Index" /> </head> <body> <div class="header"> <a id="top" name="top"></a> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> <tr> <td align="left" valign="top"> <b>Oracle® HTML DB Guide to Building Applications </b> <br /> <b>Release 2.0 </b> </td> <td valign="bottom" align="right"> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="225"> <tr><td> </td> <td align="center" valign="top"><a href="toc.htm"><img src="./support/gifs/toc.gif" alt="Go To Table Of Contents" border="0" /><br /><span class="icon">Contents</span></a></td> </table> </td> </tr> </table> <hr /> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100"> <tr> <td align="center"> <a href="bar_chart.htm"> <img src="./support/gifs/leftnav.gif" alt="Previous" border="0" /><br /><span class="icon">Previous</span></a> </td> <td align="center"> <a href="javascript.htm"> <img src="./support/gifs/rightnav.gif" alt="Next" border="0" /><br /><span class="icon">Next</span></a> </td> <td> </td> </tr> </table> </div><!-- class="header" --> <div class="IND"> <!-- End Header --><a id="CJAHDJDA" name="CJAHDJDA"></a><a id="sthref153" name="sthref153"></a> <h1><a name="HTMAD008"></a>How to Upload and Download Files in an Application</h1> <p>Oracle HTML DB applications may include the ability to upload and download files stored in the database. This tutorial illustrates how to create a form and report with links for file upload and download, how to create and populate a table to store additional attributes about the documents, and finally how to create the mechanism to download the document in your custom table. </p> <p class="subhead2">Topics:</p> <ul> <li type="disc"> <p><a href="#CIHIBBCJ">Creating an Application</a> </p> </li> <li type="disc"> <p><a href="#CIHCFCHF">Creating an Upload Form</a> </p> </li> <li type="disc"> <p><a href="#CIHBFCDH">Creating a Report with Download Links</a> </p> </li> <li type="disc"> <p><a href="#CIHBEAAD">Storing Additional Attributes About the Document</a> </p> </li> <li type="disc"> <p><a href="#CIHHEHCJ">Store the Document in a Custom Table</a> </p> </li> <li type="disc"> <p><a href="#CIHDDJGF">Downloading Documents from the Custom Table</a> </p> </li> </ul><a id="CIHIBBCJ" name="CIHIBBCJ"></a> <div class="sect1"> <!-- infolevel=all infotype=General --><a id="sthref154" name="sthref154"></a> <h2>Creating an Application </h2> <p>First, create a new application using the Create Application Wizard with the assumption you will include an upload form on page 2. </p> <p>To create an application using the Create Application Wizard: </p> <ol type="1" start="1"> <li> <p>Navigate to the Workspace home page. </p> </li> <li> <p>Click <span class="bold">Create Application</span>. </p> </li> <li> <p>On Select Creation Method, select <span class="bold">From Scratch</span> and click <span class="bold">Next</span>. </p> </li> <li> <p>For Name, enter <code>Download App</code> and click <span class="bold">Next</span>. </p> </li> <li> <p>For Tabs, select <span class="bold">No Tabs</span> and click <span class="bold">Next</span>. </p> </li> <li> <p>For Page Name, accept the defaults and click <span class="bold">Next</span>. </p> </li> <li> <p>For Theme, select <span class="bold">Theme 2</span> and click <span class="bold">Next</span>. </p> </li> <li> <p>Click <span class="bold">Create Application</span>. </p> </li> </ol> </div><!-- class="sect1" --> <a id="CIHCFCHF" name="CIHCFCHF"></a> <div class="sect1"> <a id="sthref155" name="sthref155"></a> <h2>Creating an Upload Form </h2> <p>Once you create an application, the next step is to create a form to upload documents. In the following exercise you create a form in an HTML region that contains a file upload item and a button. The button submits the page and returns the user to the same page. </p> <p class="subhead2">Topics:</p> <ul> <li type="disc"> <p><a href="#CJAFGBDI">Create an HTML Region</a> </p> </li> <li type="disc"> <p><a href="#CJADIIIH">Create an Upload Item</a> </p> </li> <li type="disc"> <p><a href="#CJAFCIEH">Create a Button</a> </p> </li> </ul><a id="CJAFGBDI" name="CJAFGBDI"></a> <div class="sect2"> <!-- infolevel=all infotype=General --><a id="sthref156" name="sthref156"></a> <h3>Create an HTML Region </h3> <p>To create an HTML region: </p> <ol type="1" start="1"> <li> <p>Navigate to the Page Definition of page 2. </p> </li> <li> <p>Under Regions, click the <span class="bold">Create</span> icon. </p> </li> <li> <p>On Identify Region Type, select <span class="bold">HTML</span> and click <span class="bold">Next</span>. </p> </li> <li> <p>On Region Type, select <span class="bold">HTML</span> and click <span class="bold">Next</span>. </p> </li> <li> <p>For the Region Title, enter <span class="bold">Submit File</span> and click <span class="bold">Next</span>. </p> </li> <li> <p>Accepting the remaining defaults and click <span class="bold">Create Region</span>. </p> </li> </ol> </div><!-- class="sect2" --> <a id="CJADIIIH" name="CJADIIIH"></a> <div class="sect2"> <!-- infolevel=all infotype=General --><a id="sthref157" name="sthref157"></a> <h3>Create an Upload Item </h3> <p>To create a file upload item: </p> <ol type="1" start="1"> <li> <p>Navigate to the Page Definition of page 2. </p> </li> <li> <p>Under Items, click the <span class="bold">Create</span> icon. </p> </li> <li> <p>On Choose Item Type, select <span class="bold">File Browse</span> and click <span class="bold">Next</span>. </p> </li> <li> <p>For Item Name, enter <code>P2_FILE_NAME</code> and click <span class="bold">Next</span>. </p> </li> <li> <p>Accept the remaining defaults and click <span class="bold">Create Item</span>. </p> </li> </ol> </div><!-- class="sect2" --> <a id="CJAFCIEH" name="CJAFCIEH"></a> <div class="sect2"> <!-- infolevel=all infotype=General --><a id="sthref158" name="sthref158"></a> <h3>Create a Button </h3> <p>To create a button: </p> <ol type="1" start="1"> <li> <p>Under Buttons, click the <span class="bold">Create</span> icon. </p> </li> <li> <p>For the region, select <span class="bold">Submit File 1.10</span> and click <span class="bold">Next</span>. </p> </li> <li> <p>For Task, select <span class="bold">Create a button in a region position</span> and click <span class="bold">Next</span>. </p> </li> <li> <p>On Identify Button Name and Label: </p> <ol type="a"> <li> <p>For Button Name, enter <code>Submit</code>. </p> </li> <li> <p>Accept the remaining defaults. </p> </li> <li> <p>Click <span class="bold">Next</span>. </p> </li> </ol> </li> <li> <p>For Button template, accept the default and click <span class="bold">Next</span>. </p> </li> <li> <p>On Display Properties, accept the defaults and click <span class="bold">Next</span>. </p> </li> <li> <p>On Branching: </p> <ol type="a"> <li> <p>In Branch to Page, select <span class="bold">page 2</span>. </p> </li> <li> <p>Click <span class="bold">Create Button</span>. </p> </li> </ol> </li> <li> <p>Run the page by clicking the <span class="bold">Run Page</span> icon. </p> </li> <li> <p>When prompted for a user name and password: </p> <ol type="a"> <li> <p>For User Name, enter the name of your workspace </p> </li> <li> <p>For Password, enter the password for your workspace </p> </li> <li> <p>Click <span class="bold">Login</span>. </p> </li> </ol> </li> </ol> <p>When you run the page, it should look similar <a href="#CHDEHCJC">Figure 8-1</a>. </p> <div class="figure"> <a id="CHDEHCJC" name="CHDEHCJC"></a><a id="sthref159" name="sthref159"></a> <p class="titleinfigure">Figure 8-1 Submit File Form</p> <img src="./img/dn_app_1.gif" alt="Description of dn_app_1.gif follows" title="Description of dn_app_1.gif follows"/> <br /><a id="sthref160" name="sthref160" href="./img_text/dn_app_1.htm">Description of the illustration dn_app_1.gif</a> <br /><br /> </div><!-- class="figure" --> </div><!-- class="sect2" --> </div><!-- class="sect1" --> <a id="CIHBFCDH" name="CIHBFCDH"></a> <div class="sect1"> <a id="sthref161" name="sthref161"></a> <h2>Creating a Report with Download Links </h2> <p>Once you create the form to upload documents, the next step is to create a report on the document table that contains links to download documents. When you use the file upload item type, the files you upload are stored in a table called <code>wwv_flow_file_objects$</code>. Every workspace has access to this table through a view called <code>HTMLDB_APPLICATION_FILES</code>. </p> <p class="subhead2">Topics:</p> <ul> <li type="disc"> <p><a href="#CJADGCJD">Create a Report on HTMLDB_APPLICATION_FILES</a> </p> </li> <li type="disc"> <p><a href="#CJAJCABC">Add Link to Download Documents</a> </p> </li> </ul><a id="CJADGCJD" name="CJADGCJD"></a> <div class="sect2"> <!-- infolevel=all infotype=General --><a id="sthref162" name="sthref162"></a> <h3>Create a Report on HTMLDB_APPLICATION_FILES </h3> <p>To create a report on <code>HTMLDB_APPLICATION_FILES</code>: </p> <ol type="1" start="1"> <li> <p>Navigate to the Page Definition of page 2. </p> </li> <li> <p>Under Regions, click the <span class="bold">Create</span> icon. </p> </li> <li> <p>On Identify Region Type, select <span class="bold">Report</span> and click <span class="bold">Next</span>. </p> </li> <li> <p>From Report Implementation, select <span class="bold">SQL Report</span> and click <span class="bold">Next</span>. </p> </li> <li> <p>For Region Title, enter <code>Uploaded Files</code> and click <span class="bold">Next</span>. </p> </li> <li> <p>On Page Region Source, enter the following SQL query: </p> <pre xml:space="preserve" class="oac_no_warn">SELECT id,name FROM HTMLDB_APPLICATION_FILES </pre> </li> <li> <p>Click <span class="bold">Create Region</span>. </p> </li> <li> <p>Run the page. </p> </li> </ol> <p>As shown in <a href="#CHDFGJAE">Figure 8-2</a>, the report you just created shows all documents that have been uploaded. Next, you provide a link to download the document. </p> <div class="figure"> <a id="CHDFGJAE" name="CHDFGJAE"></a><a id="sthref163" name="sthref163"></a> <p class="titleinfigure">Figure 8-2 Uploaded Files Report</p> <img src="./img/dn_app_1a.gif" alt="Description of dn_app_1a.gif follows" title="Description of dn_app_1a.gif follows"/> <br /><a id="sthref164" name="sthref164" href="./img_text/dn_app_1a.htm">Description of the illustration dn_app_1a.gif</a> <br /><br /> </div><!-- class="figure" --> </div><!-- class="sect2" --> <a id="CJAJCABC" name="CJAJCABC"></a> <div class="sect2"> <!-- infolevel=all infotype=General --><a id="sthref165" name="sthref165"></a> <h3>Add Link to Download Documents </h3> <p>To provide a link to download the documents in the report: </p> <ol type="1" start="1"> <li> <p>Navigate to the Page Definition of page 2. </p> </li> <li> <p>Under Regions, click <span class="bold">Q</span> next to Uploaded Files. </p> </li> <li> <p>Under Report Column Attributes, click the <span class="bold">Edit</span> icon next to the <code>ID</code> column. </p> </li> <li> <p>Scroll down to Column Link. Under Column Link: </p> <ol type="a"> <li> <p>In the Link Text field, enter: </p> <pre xml:space="preserve" class="oac_no_warn">download </pre> </li> <li> <p>From Target, select <span class="bold">URL</span>. </p> </li> <li> <p>In the URL field, enter the following: </p> <pre xml:space="preserve" class="oac_no_warn">p?n=#ID# </pre> </li> </ol> </li> <li> <p>Click <span class="bold">Apply Changes</span>. </p> </li> </ol> <p>When you run the page, it should look similar to <a href="#CHDHFDGD">Figure 8-3</a>. </p> <div class="figure"> <a id="CHDHFDGD" name="CHDHFDGD"></a><a id="sthref166" name="sthref166"></a> <p class="titleinfigure">Figure 8-3 Uploaded Files Report with Download Links</p> <img src="./img/dn_app_2.gif" alt="Description of dn_app_2.gif follows" title="Description of dn_app_2.gif follows"/> <br /><a id="sthref167" name="sthref167" href="./img_text/dn_app_2.htm">Description of the illustration dn_app_2.gif</a> <br /><br /> </div><!-- class="figure" --> </div><!-- class="sect2" --> </div><!-- class="sect1" --> <a id="CIHBEAAD" name="CIHBEAAD"></a> <div class="sect1"> <a id="sthref168" name="sthref168"></a> <h2>Storing Additional Attributes About the Document </h2> <p>Next, you create another table to store additional information about the documents that are uploaded. In this exercise you: </p> <ul> <li type="disc"> <p>Add an item to the upload form to capture the information </p> </li> <li type="disc"> <p>Add a process to insert this information along with the name of the file </p> </li> <li type="disc"> <p>Alter the SQL Report of uploaded files to join to the table containing the additional information </p> </li> </ul> <p class="subhead2">Topics:</p> <ul> <li type="disc"> <p><a href="#CJAJJEGE">Create a Table to Store Document Attributes</a> </p> </li> <li type="disc"> <p><a href="#CJABEDEH">Create an Item to Capture the Document Subject</a> </p> </li> <li type="disc"> <p><a href="#CJAFHBBC">Create a Process to Insert Information</a> </p> </li> <li type="disc"> <p><a href="#CJAGBBIF">Showing Additional Attributes in the Report Region</a> </p> </li> </ul><a id="CJAJJEGE" name="CJAJJEGE"></a> <div class="sect2"> <!-- infolevel=all infotype=General --><a id="sthref169" name="sthref169"></a> <h3>Create a Table to Store Document Attributes </h3> <p>To create the table to store additional information about uploaded files: </p> <ol type="1" start="1"> <li> <p>Navigate to Workspace home page. </p> </li> <li> <p>Click <span class="bold">SQL Workshop</span>. </p> </li> <li> <p> Click <span class="bold">SQL Command Processor.</span> </p> </li> <li> <p>In the SQL Statement field, enter </p> <pre xml:space="preserve" class="oac_no_warn">CREATE TABLE file_subjects(name VARCHAR2(4000), subject VARCHAR2(4000) ); </pre> </li> <li> <p>Click <span class="bold">Run SQL</span>. </p> </li> </ol> </div><!-- class="sect2" --> <a id="CJABEDEH" name="CJABEDEH"></a> <div class="sect2"> <!-- infolevel=all infotype=General --><a id="sthref170" name="sthref170"></a> <h3>Create an Item to Capture the Document Subject </h3> <p>To create an item to capture the subject of the document: </p> <ol type="1" start="1"> <li> <p>Navigate to the Page Definition of page 2. </p> </li> <li> <p>Under Items, click the <span class="bold">Create</span> icon. </p> </li> <li> <p>On Choose Item Type, select <span class="bold">Text</span> and click <span class="bold">Next</span>. </p> </li> <li> <p>On Pick Text Control, select <span class="bold">Text Field</span> and click <span class="bold">Next</span>. </p> </li> <li> <p>On Identify Item Name and Display Position: </p> <ol type="a"> <li> <p>For Item Name, enter <code>P2_SUBJECT</code>. </p> </li> <li> <p>From the Region list, select <span class="bold">Uploaded Files</span>. </p> </li> <li> <p>Accepting the remaining defaults and click <span class="bold">Next</span>. </p> </li> </ol> </li> <li> <p>On Identify Item Attributes: </p> <ol type="a"> <li> <p>In the Label field, enter <code>Subject</code>. </p> </li> <li> <p>Accepting the remaining defaults. </p> </li> <li> <p>Click <span class="bold">Next</span>. </p> </li> </ol> </li> <li> <p>Click <span class="bold">Create Item</span>. </p> </li> </ol> </div><!-- class="sect2" --> <a id="CJAFHBBC" name="CJAFHBBC"></a> <div class="sect2"> <!-- infolevel=all infotype=General --><a id="sthref171" name="sthref171"></a> <h3>Create a Process to Insert Information </h3> <p>To create a process to insert the subject information into the new table: </p> <ol type="1" start="1"> <li> <p>Navigate to the Page Definition of page 2 </p> </li> <li> <p>Under Page Processing, Processes, click the <span class="bold">Create</span> icon. </p> </li> <li> <p>On Select Process Type, click <span class="bold">PL/SQL.</span> </p> </li> <li> <p>On Identify Process Attributes: </p> <ol type="a"> <li> <p>For Name, enter <code>Insert</code>. </p> </li> <li> <p>From Point, select <span class="bold">On Submit - After Computations and Validations</span>. </p> </li> <li> <p>For Type, select <span class="bold">PL/SQL anonymous block</span>. </p> </li> <li> <p>Click <span class="bold">Next</span>. </p> </li> </ol> </li> <li> <p>On Identify Page Process, enter the following PL/SQL process: </p> <pre xml:space="preserve" class="oac_no_warn">INSERT INTO file_subjects(name, subject) VALUES(:P2_FILE_NAME,:P2_SUBJECT); </pre> </li> <li> <p>On Identify Messages: </p> <ol type="a"> <li> <p>In the Success Message field, enter: </p> <pre xml:space="preserve" class="oac_no_warn">Subject inserted </pre> </li> <li> <p>In the Failure Message field, enter: <code></code> </p> <pre xml:space="preserve" class="oac_no_warn">Error inserting subject </pre> </li> <li> <p>Click <span class="bold">Next</span>. </p> </li> </ol> </li> <li> <p>From When Button Pressed, select <span class="bold">SUBMIT</span>. </p> </li> <li> <p>Click <span class="bold">Create Process</span>. </p> </li> </ol> </div><!-- class="sect2" --> <a id="CJAGBBIF" name="CJAGBBIF"></a> <div class="sect2"> <!-- infolevel=all infotype=General --><a id="sthref172" name="sthref172"></a> <h3>Showing Additional Attributes in the Report Region </h3> <p>To alter the SQL Report region to join to the additional attributes table: </p> <ol type="1" start="1"> <li> <p>Under Regions, select <span class="bold">Uploaded Files</span>. </p> </li> <li> <p>Replace the Region Source with the following: </p> <pre xml:space="preserve" class="oac_no_warn">SELECT w.id,w.name,s.subject FROM HTMLDB_APPLICATION_FILES w,file_subjects s WHERE w.name = s.name </pre> </li> <li> <p>Click <span class="bold">Apply Changes</span>. </p> <p>Run the page. As shown in <a href="#CHDIEIFD">Figure 8-4</a>, the Uploaded Files report now contains a Subject column. </p> <div class="figure"> <a id="CHDIEIFD" name="CHDIEIFD"></a><a id="sthref173" name="sthref173"></a> <p class="titleinfigure">Figure 8-4 Uploaded Files Report with Subject Column</p> <img src="./img/dn_sub_col.gif" alt="Description of dn_sub_col.gif follows" title="Description of dn_sub_col.gif follows"/> <br /><a id="sthref174" name="sthref174" href="./img_text/dn_sub_col.htm">Description of the illustration dn_sub_col.gif</a> <br /><br /> </div><!-- class="figure" --> </li> </ol> </div><!-- class="sect2" --> </div><!-- class="sect1" --> <a id="CIHHEHCJ" name="CIHHEHCJ"></a> <div class="sect1"> <a id="sthref175" name="sthref175"></a> <h2>Store the Document in a Custom Table </h2> <p>In certain cases, you may want to store uploaded documents in a table owned by your schema. For example, if you want to create an Oracle Text Index on uploaded documents, you need to store the documents in a custom table. </p> <p>To store documents in your custom table: </p> <ul> <li type="disc"> <p>Add a column of type <code>BLOB</code> to hold the document </p> </li> <li type="disc"> <p>Alter the process to insert documents into the custom table </p> </li> </ul> <p>To add a BLOB column to the <code>file_subjects</code> table: </p> <ol type="1" start="1"> <li> <p>Navigate to the Workspace home page. </p> </li> <li> <p>Click <span class="bold">SQL Workshop</span>. </p> </li> <li> <p>Click <span class="bold">SQL Command Processor</span>. </p> </li> <li> <p>Enter the following SQL statement: </p> <pre xml:space="preserve" class="oac_no_warn">ALTER TABLE file_subjects ADD(id number,blob_content BLOB,mime_type varchar2(4000) ); </pre> </li> <li> <p>Click <span class="bold">Run SQL</span>. </p> </li> </ol> <p>To alter the process to insert documents into the <code>file_subjects</code> table: </p> <ol type="1" start="1"> <li> <p>Navigate to the Page Definition of page 2. </p> </li> <li> <p>Under Page Processing, select <span class="bold">Insert</span>. </p> </li> <li> <p>Under source, replace the process with the following: </p> <pre xml:space="preserve" class="oac_no_warn"> IF ( :P2_FILE_NAME is not null ) THEN INSERT INTO file_subjects(id,NAME, SUBJECT, BLOB_CONTENT, MIME_TYPE) SELECT ID,:P2_FILE_NAME,:P2_SUBJECT,blob_content,mime_type FROM HTMLDB_APPLICATION_FILES WHERE name = :P2_FILE_NAME; DELETE from HTMLDB_APPLICATION_FILES WHERE name = :P2_FILE_NAME; END IF; </pre> </li> <li> <p>Click <span class="bold">Apply Changes</span>. </p> </li> </ol> </div><!-- class="sect1" --> <a id="CIHDDJGF" name="CIHDDJGF"></a> <div class="sect1"> <a id="sthref176" name="sthref176"></a> <h2>Downloading Documents from the Custom Table </h2> <p>Now that documents are being stored in a custom table, you need to provide a way to download them. You do this by creating a procedure and granting execute on that procedure to the pseudo user <code>HTMLDB_PUBLIC_USER</code>. </p> <p>To accomplish this you need to change: </p> <ul> <li type="disc"> <p>The SQL report region to no longer join to the <code>HTMLDB_APPLICATION_FILES</code> view </p> </li> <li type="disc"> <p>The URL supplied for the ID column in the SQL report to execute the new procedure instead of executing the p procedure </p> </li> </ul> <p>To create a procedure to download documents from the <code>file_subjects</code> table and grant execute to public: </p> <ol type="1" start="1"> <li> <p>Navigate to the SQL Workshop. </p> </li> <li> <p>Click <span class="bold">SQL Command Processor.</span> </p> </li> <li> <p>In the SQL Statement field, enter: </p> <pre xml:space="preserve" class="oac_no_warn"> CREATE OR REPLACE PROCEDURE download_my_file(p_file in number) AS v_mime VARCHAR2(48); v_length NUMBER; v_file_name VARCHAR2(2000); Lob_loc BLOB; BEGIN SELECT MIME_TYPE, BLOB_CONTENT, name,DBMS_LOB.GETLENGTH(blob_content) INTO v_mime,lob_loc,v_file_name,v_length FROM file_subjects WHERE id = p_file; -- -- set up HTTP header -- -- use an NVL around the mime type and -- if it is a null set it to application/octect -- application/octect may launch a download window from windows owa_util.mime_header( nvl(v_mime,'application/octet'), FALSE ); -- set the size so the browser knows how much to download htp.p('Content-length: ' || v_length); -- the filename will be used by the browser if the users does a save as htp.p('Content-Disposition: attachment; filename="'||substr(v_file_name,instr(v_file_name,'/')+1)|| '"'); -- close the headers owa_util.http_header_close; -- download the BLOB wpg_docload.download_file( Lob_loc ); end download_my_file; / </pre> </li> <li> <p>Click <span class="bold">Run SQL</span>. </p> </li> <li> <p>In the SQL Statement field, enter: </p> <pre xml:space="preserve" class="oac_no_warn">GRANT EXECUTE ON download_my_file TO PUBLIC/ </pre> </li> <li> <p>Click <span class="bold">Run SQL</span>. </p> </li> </ol> <p>To change the SQL report region to no longer join with the <code>HTMLDB_APPLICATION_FILES</code> view: </p> <ol type="1" start="1"> <li> <p>Navigate to the Page Definition of page 2. </p> </li> <li> <p>Under Regions, select <span class="bold">Uploaded Files</span>. </p> </li> <li> <p> Replace the Region Source with the following: </p> <pre xml:space="preserve" class="oac_no_warn">SELECT s.id,s.name,s.subject FROM file_subjects s </pre> </li> <li> <p> Click <span class="bold">Apply Changes</span>. </p> </li> </ol> <p>To change the download link to use the new download procedure: </p> <ol type="1" start="1"> <li> <p>Navigate to the Page Definition of page 2. </p> </li> <li> <p>Under Regions, click <span class="bold">Q</span> next to Uploaded Files. </p> </li> <li> <p>Next to the ID column, click the <span class="bold">Edit</span> icon. </p> </li> <li> <p>Scroll down to the Column Link region. </p> </li> <li> <p>Replace existing URL with the following </p> <pre xml:space="preserve" class="oac_no_warn">#OWNER#.download_my_file?p_file=#ID# </pre> </li> <li> <p>Click <span class="bold">Apply Changes</span>. </p> </li> </ol> </div><!-- class="sect1" --> </div> <!-- Start Footer --> <div class="footer"> <hr /> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100%"> <tr> <td valign="bottom" width="33%"> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="100"> <tr><td> </td> <td align="center"> <a href="bar_chart.htm"> <img src="./support/gifs/leftnav.gif" alt="Previous" border="0" /><br /><span class="icon">Previous</span></a> </td> <td align="center"> <a href="javascript.htm"> <img src="./support/gifs/rightnav.gif" alt="Next" border="0" /><br /><span class="icon">Next</span></a> </td> </tr> </table> </td> <td class="copyrightlogo"> <a href="./support/html/cpyr.htm"> <span class="copyrightlogo"> Copyright © 2005, Oracle. All rights reserved. </span> </a> </td> <td valign="bottom" align="right" width="33%"> <table class="simple oac_no_warn" summary="" cellspacing="0" cellpadding="0" width="225"> <tr><td> </td> <td align="center" valign="top"><a href="toc.htm"><img src="./support/gifs/toc.gif" alt="Go To Table Of Contents" border="0" /><br /><span class="icon">Contents</span></a></td> </table> </td> </tr> </table> </div><!-- class="footer" --> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de