例子可参考aooi100,上传集团logo的程序
1 ON ACTION btn_updatelogo #選取上傳檔案,GDC專用
2 LET gs_upload = NULL
3 CALL cl_client_browse_file() RETURNING gs_upload
4 IF NOT cl_null(gs_upload) THEN #C:/Users/P12345/Desktop/title/hlep_titlebg1.png
5 LET g_file_extension = os.Path.extension(gs_upload) #副檔名
6
7 #放在暫存目錄要改名,避免檔名重複
8 LET gs_pid = FGL_GETPID()
9 LET g_num = g_num + 1
10 LET g_str = g_num
11 LET g_new_path = g_prog CLIPPED,"_",gs_pid CLIPPED,"_",g_user CLIPPED,"_",g_str CLIPPED,".",g_file_extension
12 LET g_new_path = os.Path.join(FGL_GETENV("TEMPDIR"),g_new_path CLIPPED)
13 CALL FGL_GETFILE(gs_upload,g_new_path) #Transfers a file from the front end workstation to the application server machine.
14 IF os.Path.exists(g_new_path) THEN
15 LET g_tmpfile = g_new_path
16 LET g_ooek_fileimg = g_tmpfile
17 DISPLAY g_ooek_fileimg TO FORMONLY.fileimg
18
19 LET g_logo_flag = "Y"
20
21 INITIALIZE g_errparam TO NULL
22 LET g_errparam.code = "aoo-00398"
23 LET g_errparam.extend = ""
24 LET g_errparam.popup = TRUE
25 CALL cl_err()
26 CONTINUE DIALOG
27 ELSE
28 LET g_ooek_fileimg = NULL
29 DISPLAY g_ooek_fileimg TO FORMONLY.fileimg
30
31 INITIALIZE g_errparam TO NULL
32 LET g_errparam.code = "azz-00101"
33 LET g_errparam.extend = ""
34 LET g_errparam.popup = TRUE
35 CALL cl_err()
36
37 CONTINUE DIALOG
38 END IF
39 END IF
40 #end add-point
logo上傳至報表主機
1 PRIVATE FUNCTION aooi100_01_upd_logo()
2 DEFINE l_filename STRING
3 DEFINE ls_run_cmd STRING,
4 lb_run_result BOOLEAN,
5 ls_err_msg STRING
6
7
8 IF g_logo_flag = "Y" THEN
9 #logo檔案名稱為"dsdemo_99_DSCTC_zh_TW.jpg"
10 LET l_filename = g_enterprise
11 LET l_filename = g_dbs CLIPPED,"_",l_filename CLIPPED,"_",g_ooek_m.ooek001 CLIPPED,"_",g_ooek_m.ooek002 CLIPPED,".jpg"
12 CALL fgl_ws_setOption("http_invoketimeout", 60) #若 60 秒內無回應則放棄
13
14 #透過Web Service將檔案上傳到報表主機
15 LET ls_run_cmd = "r.r awsp301 ",FGL_GETENV("ZONE")," ", l_filename," ",g_new_path
16 CALL cl_cmdrun_openpipe("r.r awsp300_01", ls_run_cmd, FALSE) RETURNING lb_run_result,ls_err_msg
17 END IF
18 END FUNCTION