代码:-------------------------------------------------------------------------------- @$oracle_home/rdbms/admin/owaload.sql 使用ie对oracle http server 中的modpl/sql实施配置 Database Access Descriptor Name updown Schema Name scott Oracle User Name scott Oracle Password scott Oracle Connect String <- found in your tnsnames.ora Document Table scott.documents Document Access Procedure scott.cntsample.download
CONNECT Samples/Samples
SET DEFINE OFF
CREATE TABLE documents ( NAME VARCHAR2(256) NOT NULL, MIME_TYPE VARCHAR2(128) NULL, DOC_SIZE NUMBER NULL, DAD_CHARSET VARCHAR2(128) NULL, LAST_UPDATED DATE NULL, CONTENT_TYPE VARCHAR2(128) NULL, CONTENT LONG RAW NULL, BLOB_CONTENT BLOB ) /
CREATE TABLE documentspart ( DOCUMENT VARCHAR2(256), PART VARCHAR2(256), UPLOADED CHAR(1), constraint documentspart_pk primary key( document, part ) ) /
CREATE OR REPLACE PACKAGE cntsample IS /* This package was written by Audun V. Nes ([email protected]). The intention of this sample is to show the File Upload/Download capabilities of the PL/SQL gateway shipped with iAS. Last 0updated 24th of May 2000. */ PROCEDURE startup. PROCEDURE menu. PROCEDURE dummy. PROCEDURE upload_form. PROCEDURE upload(name IN owa.vc_arr). PROCEDURE download_form. PROCEDURE download(p_file IN VARCHAR2). PROCEDURE remove_form. PROCEDURE remove(p_file IN owa.vc_arr). END. /
CREATE OR REPLACE PACKAGE BODY cntsample IS
PROCEDURE startup IS BEGIN -- This procedure only creates a simple frameset. htp.htmlOpen. htp.framesetOpen(crows => 72,* ). htp.frame(csrc => cntsample.menu , cname => frame1 , cscrolling => NO ). htp.framesetOpen(ccols => 40%,* ). htp.frame(csrc => cntsample.dummy , cname => frame2 , cscrolling => NO ). htp.frame(csrc => cntsample.dummy , cname => frame3 , cscrolling => AUTO ). htp.framesetClose. htp.framesetClose. htp.htmlClose. EXCEPTION WHEN OTHERS THEN htp.p(sqlerrm). RETURN. END.
PROCEDURE menu IS BEGIN -- This procedure creates a simple menu from which the end user can make his choice. htp.htmlOpen. htp.bodyOpen(cattributes => TEXT="#FFFFFF" LINK="#FFFFFF" ALINK="#FFFFFF" VLINK="#FFFFFF" ). htp.tableOpen(cattributes => BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="100%" BGCOLOR="#666699" ). htp.tableRowOpen. htp.tableData(htf.img(curl => /images/wwcban.jpg )). htp.tableData(htf.fontOpen( #FFFFFF , arial,helvetica , 2 )|| Content Table Sample ||htf.fontClose). htp.tableData(htf.anchor2(curl => cntsample.upload_form , ctext => Upload File(s) , ctarget => frame2 )). htp.tableData(htf.anchor2(curl => cntsample.download_form , ctext => Download File(s) , ctarget => frame2 )). htp.tableData(htf.anchor2(curl => cntsample.remove_form , ctext => Remove File(s) , ctarget => frame3 )). htp.tableData(htf.anchor2(curl => owa_util.showsource?cname= ||owa_util.get_procedure, ctext => View Source Code , ctarget => frame3 )). htp.tableRowClose. htp.tableClose. htp.bodyClose. htp.htmlClose. EXCEPTION WHEN OTHERS THEN htp.p(sqlerrm). RETURN. END.
PROCEDURE dummy IS BEGIN -- This procedure shows an empty page with a background image. It is used in the frameset startup. htp.htmlOpen. htp.bodyOpen(cbackground => /images/wsd.gif ). htp.bodyClose. htp.htmlClose. EXCEPTION WHEN OTHERS THEN htp.p(sqlerrm). RETURN. END.
PROCEDURE upload_form IS BEGIN htp.header(3, Upload a file ). -- This procedure creates a simple HTML form that lets the end user upload his file(s). htp.formOpen(curl => cntsample.upload , cmethod => POST , cenctype => multipart/form-data ). htp.p(