Working With File Throgh WebUtill
--------------------------------------------------
Document
Required Configuraion :
By default the file transfer is disabled in webutil for a security measure. So, you have to enable File transfer configuration in webutil.cfg file. The webutil.cfg file is located in forms\server.
Open The webuil.cfg file and edit the following parameters :
transfer.database.enabled=FALSE Change To TRUE
transfer.appsrv.enabled=FALSE Change to TRUE
WebUtil_File contains APIs to manipulate files and directories on the client. These Functions Or APIs are:
Copy_File : Copies a file Returns a Boolean to indicate success.
Syntax :
Webutil_File.Copy_File(SourceFileName in Varchar2 , Destination In Varchar2) Return Boolean
Example
Declare
vCopied Boolean;
Begin
vCopied := Webutil_File.Copy_File('C:\temp\mypic.jpg','X:\destination_folder');
If vCopied = true Then
Message('File copied Successfully');
Else
Message('Error in Copying File');
End if;
Delete_File: Deletes a file. Returns a Boolean to indicate success.
Rename_File Renames a file. Returns a Boolean to indicate success.
Create_Directory Creates the named directory if it does not exist.
Any intermediate directories will also be created.
Returns a Boolean to indicate success.
Directory_Root_List Returns a FILE_LIST containing the directory roots on the client system. On a Windows PC these would correspond to the drives on the computer.
Directory_List :Returns a FILE_LIST containing all the files and subdirectories in a particular directory. There is an optional Return_Files_Only argument to restrict the returned list to just files with no directories.
Directory_Filtered_List : Like Directory_List this will return a list of files in a directory but you are able to file filter using the '*' and '?' wildcards e.g. *.FMB to restrict the list.
File_Exists :Returns a Boolean value indicating if the named file exists on the client
File_Is_Directory Returns a Boolean value indicating of the file name supplied is actually a directory on the client.
File_Is_Hidden :Returns a Boolean value indicating of the file has it's hidden attribute set.
File_Is_Readable :Returns a Boolean value indicating of the file can be read.
File_Is_Writable :Returns a Boolean value indicating of the file canbe written to.
File_Size :Returns the size of the file in bytes.
Directory_Selection_Dialog :Displays a Directory selection dialog. The initial directory and the title for the dialog can be defined. The selected directory is returned.
File_Selection_Dialog :Allows the definition of a File Save or Open dialog with a configurable file filter. Returns a single file selection. The file filter can use ? and * as wildcards and is in the format |
can be specified, e.g. |Gif Files|*.gif|JPEG Files|*.jpg|.
File_Multi_Selection_Dialog :As File_Selection_Dialog except that the user can select multiple files and these are returned in a FILE_LIST.
File_Open_Dialog :A convenience method that creates a File Open Dialog. File_Save_Dialog A convenience method that creates a File Save Dialog.
Get_file_Separator :Returns the character used on the client computer as the file separator e.g. "\" on Windows.
Get_Path_Separator :Returns the character used to separate directory locations on Paths e.g. ";" on Windows.
Document
Comments