ようこそ (Jyokoso) MY BLOG

いらっしゃいませ (hajimemashite) สำหรับผู้เข้าใหม่นะค่ะ ^^V

05 มีนาคม 2555

uplaod photo โดยใช้ WEBUTIL_FILE_TRANSFER





declare
FDialog_Bean               Item;
file_name                       Varchar2(255);
old_file_name               Varchar2(255);
l_success                       boolean;
v_client_home               Varchar2(255) := webutil_clientinfo.get_system_property('user.home');
V_IMAGE_URL       Varchar2(150);--add by dee
L_BARE_FILENAME  Varchar2(150);--add by dee
     
begin      
      if  Get_Application_property(USER_INTERFACE) = 'WEB'  then    

file_name := client_get_file_name(directory_name  => v_client_home--comment by dee :parameter.image_path
 ,file_name      => null
 ,file_filter       => null
 ,message       => null
 ,dialog_type  => null
 ,select_file     => TRUE--null
);

if length(file_name) > 255 then
show_message('Image path is over 255 characters.');
go_item('b_fixed_price_group.image_btn');
raise form_trigger_failure;
end if;

IF file_name is not null THEN
go_block('b_fixed_price_group');
Client_Image.read_image_file(file_name, '', 'b_fixed_price_group.image');
END IF;


--add by dee@02/03/2012
BEGIN
 ---------------------------------Get file Path---------------------------------    
BEGIN
   SELECT DEF_LIMAGE, IMAGE_URL --C_DEFAULT_UPLOAD_PATH
   INTO   :PARAMETER.PATH_FILE, V_IMAGE_URL
   FROM   B_COMPANY
   WHERE  F_DEFAULT = 'Y';
   EXCEPTION WHEN NO_DATA_FOUND THEN :PARAMETER.PATH_FILE := NULL;
END;
L_BARE_FILENAME := SUBSTR(FILE_NAME,INSTR(FILE_NAME,'\',-1)+1);
------------------------------Upload file to Server-----------------------------  
L_SUCCESS := WEBUTIL_FILE_TRANSFER.CLIENT_TO_AS_WITH_PROGRESS
             (CLIENTFILE       => FILE_NAME
             --,SERVERFILE       => :PARAMETER.PATH_FILE||'\'||L_BARE_FILENAME
             ,SERVERFILE       => :PARAMETER.PATH_FILE||'\'||:B_FIXED_PRICE_GROUP.FIXED_PRICE_GROUP||'.jpg'
             ,PROGRESSTITLE    => 'Upload to Application Server in progress'
             ,PROGRESSSUBTITLE => 'Please wait'
             ,ASYNCHRONOUS     => FALSE
             ,CALLBACKTRIGGER  => NULL );
 IF L_SUCCESS THEN
:B_FIXED_PRICE_GROUP.LARGE_IMAGE_PATH := :PARAMETER.PATH_FILE||'\'||:B_FIXED_PRICE_GROUP.FIXED_PRICE_GROUP||'.jpg';
:B_FIXED_PRICE_GROUP.LARGE_IMAGE_URL := V_IMAGE_URL||:B_FIXED_PRICE_GROUP.FIXED_PRICE_GROUP||'.jpg';
--COMMIT;
:SYSTEM.MESSAGE_LEVEL := 0;
 ELSE
   MESSAGE('File upload to Application Server failed');
 END IF;
EXCEPTION WHEN OTHERS THEN
  MESSAGE('File upload failed: '||SQLERRM);  
END;
  end if;  
     
end;



ไม่มีความคิดเห็น:

แสดงความคิดเห็น