Sage X3 Upload File From Client To Server

SOLVED

Hi,

I am trying to create an upload to the server from the client. The below code works but how do I keep the original filename instead of specifying the filename manually in FICSRV. Also how do you know the document type?

Local Integer STAT
Local Char FICSRV(GDIMFIC),FICCLI(GDIMFIC)

FICCLI= ""

FICSRV= filpath("MTD",num$(timestamp$), "")
Call SET_NAMCLI(FICCLI) From ORDSYS
Call COPSRV(FICCLI,FICSRV,STAT) From ORDSYS