		m.pdfFile = "PUTANJA DO FAJLA KOJI SALJEMO" && c:\ljubo\salji.txt
		m.uploadPdfFile = "NAZIV FAJLA KAKO ZELIMO DA SE ZOVE NA FTP-u" && 445500_dokument_xxx.txt

*		if Not File(m.pdfFile)
*	        mErrorState = "ERROR"
*	        mErrorMessage = "Neuspelo generisanje PDF fajla!"
*	        THROW NewObject("TApiException","TApiExceptionU.prg",null, mErrorState, mErrorMessage)
*		Endif

*** FTP DEO
        m.API_FTP_ON=1
        m.API_FTP_PORT=21
        m.API_FTP_HOME_FOLDER=""
        m.API_FTP_PASSIVE=1
        m.API_FTP_ADRESA = "ftp.catic.itm.rs"
        m.API_FTP_USER = "edi_catic"
        m.API_FTP_PASSWORD = "pHQHwQvr"
        m.API_FTP_IN_FOLDER = "IN"
        m.API_FTP_OUT_FOLDER = "OUT"
        m.API_FTP_FAKTURE_FOLDER = "FAKTURE"

        MY = get_VPAR("API_CATIC_FTP","","","")
		If !Empty(m.MY) And Type('MY') = 'C'
			Store Memlines(m.MY) To YY
			Store 0 To _Mline
			For COUNTER = 1 To YY
				KOMANDA = Alltrim(Mline(m.MY, 1, _Mline))
				If !Empty(KOMANDA) And !(Left(KOMANDA, 1) = "*")  And !(Left(KOMANDA, 2) = "&" + "&")
					If At("&" + "&", KOMANDA) > 2
						KOMANDA = Substr(KOMANDA,1,At("&" + "&", KOMANDA)-1)
					Endif
					&KOMANDA
				Endif
			Next
		Endif		

*** UPLOAD
		Oftp = Newobject('TFoxTfp',"tftp.prg")

		Oftp.Host = Alltrim("ftp.catic.itm.rs")
		Oftp.usr=m.API_FTP_USER
		Oftp.pswd=m.API_FTP_PASSWORD
		Oftp.PORT = 21
		Oftp.Passive = .T.

		Wait Window "FTP: "+"Konekcija na " + m.API_FTP_ADRESA Nowait
		Try
			Oftp.FtpConnect()
			ok2Go = Oftp.IsConnected
		Catch To oErr
			Wait Clear
			ok2Go = .F.
			Release Oftp
	        mErrorState = "ERROR"
	        mErrorMessage = "Greska prilikom konekcije na ftp server!"
*	        THROW NewObject("TApiException","TApiExceptionU.prg",null, mErrorState, mErrorMessage)
		Endtry

		Wait Window "FTP: "+"Prelazak na folder" Nowait
		Try
			Oftp.SetCurrentDir("/"+m.API_FTP_FAKTURE_FOLDER)
		Catch To oErr
			ok2Go = .F.
			Release Oftp
	        mErrorState = "ERROR"
	        mErrorMessage = "Greska pri prelasku na folder: "+m.API_FTP_FAKTURE_FOLDER
*	        THROW NewObject("TApiException","TApiExceptionU.prg",null, mErrorState, mErrorMessage)
		Endtry

		Try
			Oftp.PutToFtp(m.pdfFile, m.uploadPdfFile, 1024*1000)
			oFTP.ExecCmd("HELP",0)
		Catch To oErr
			ok2Go = .F.
			Release Oftp
	        mErrorState = "ERROR"
	        mErrorMessage = "Greska pri upisu fajla na fpt: "+m.pdfFile
*	        THROW NewObject("TApiException","TApiExceptionU.prg",null, mErrorState, mErrorMessage)
		Endtry

		Try
			oFtp.FtpDisconnect()
			Release Oftp
		Catch To oErr
			ok2Go = .F.
			Release Oftp
		Endtry
