1. Purpose
The purpose of this article is to demonstrate how, with the Webutil library, we can upload local documents into the database, edit those stored documents on the client machine, save modified documents to the database
2. Upload local document to the database
Select a file on the client machine with the WEBUTIL_FILE.FILE_OPEN_DIALOG function
FUNCTION WEBUTIL_FILE.FILE_OPEN_DIALOG
(
directory_name,
file_name,
file_filter,
title
) return VARCHAR2;
- directory_name is the name of the starting directory (let empty to start at the root)
- file_name is the name of the searching file
- file_filter is the list of file types to display (e.g. '|All files|*.*|' or '|Word Files|*.doc|Excel Files|*.xls|')
- title is the title of the dialog box
Upload the selected document into the database with the Webutil_File_Transfer.Client_To_DB function
FUNCTION Webutil_File_Transfer.Client_To_DB
(
clientFile in VARCHAR2,
tableName in VARCHAR2,
columnName in VARCHAR2,
whereClause in VARCHAR2,
asynchronous in BOOLEAN default FALSE,
callbackTrigger in VARCHAR2 default NULL
) return BOOLEAN;
- clientFile is the full file name returned by the File_Open_Dialog() function
- tableName is the table that contains a BLOB column
- columnName is the BLOB column you want to store the file
- whereClause is the Where clause to identify a unique raw in the table
- asynchronous allows form to re-draw its screen before the end of the upload
- callbackTrigger is the name of a form-level trigger which will be called once the upload is completed.
Declare
LB$Result BOOLEAN ;
Begin
LB$Result := Webutil_File_Transfer.Client_To_DB
(
‘c:\docs\doc.xls’,
‘DOCUMENTS’,
‘DOC’,
‘DOC_ID = 10’
) ;
End ;
No comments:
Post a Comment