Copy or Transfer file from Client to Server
300230Apr 28 2008 — edited Apr 30 2008I want to copy a file from Client (windows XP) to server (AIX).
Below is my WHEN-BUTTON-PRESSED trigger, I am using both the copy and transfer function in the same trigger. If the copy fails then use the transfer utility. I have been reading the forums posting all day. could not figure out.
Any help is appriciated..
Code:
declare
v_file varchar2(30) := null;
client_file varchar2(150);
server_file varchar2(150);
blnRet BOOLEAN;
begin
:BL1.attached_file := webutil_file.file_selection_dialog(
directory_name => 'C:\Documents and Settings\mc20804\Habeeb',
file_name => null,
file_filter => '*.*',
title => 'Select File to LOAD',
dialog_type => open_file,
select_file => TRUE);
v_file := substr(:BL1.attached_file,
instr(:BL1.attached_file, '\', -1) + 1);
client_file := :BL1.attached_file;
server_file := '/u01/apps/oas/midtier/forms/osc' || '/' || v_file;
blnRet := Webutil_File.Copy_File(client_file, server_file);
if blnRet then
message('file copied');
else
blnRet := WEBUTIL_FILE_TRANSFER.Client_To_AS(client_file, server_file);
if blnRet then
message('file copied by transfer');
else
message('file not copied by transfer');
end if;
end if;
EXCEPTION
WHEN OTHERS THEN
message('Error Loading File');
END;
Webutil.cfg Original did not work on this:
#NOTE: By default the file transfer is disabled as a security measure
transfer.database.enabled=TRUE
transfer.appsrv.enabled=TRUE
transfer.appsrv.workAreaRoot=c:\temp
transfer.appsrv.accessControl=TRUE
#List transfer.appsrv.read.<n> directories
transfer.appsrv.read.1=c:\temp
#List transfer.appsrv.write.<n> directories
transfer.appsrv.write.1=c:\temp
Modified webutil.cfg to this:
#NOTE: By default the file transfer is disabled as a security measure
transfer.database.enabled=TRUE
transfer.appsrv.enabled=TRUE
transfer.appsrv.workAreaRoot=c:\temp
transfer.appsrv.accessControl=TRUE
#List transfer.appsrv.read.<n> directories
transfer.appsrv.read.1=c:\temp
#List transfer.appsrv.write.<n> directories
#Habeeb 04/28/2008 added 2 lines below
List transfer.appsrv.write.<2> directories
transfer.appsrv.write.1=/u01/apps/oas/midtier/forms/osc
transfer.appsrv.write.2=c:\temp