How to check FTP send successful in Flexy?

I use flexy 205 to send data from flexy to sever via ftp sever
need to know the putftp is success?what function i should use?
thanks for your help

Hello @duy27trong,

See the following example from our developer.ewon.biz page. After you call putFTP you can get the Action ID and check that the action has completed.

https://developer.ewon.biz/content/ftp

Deryck

thanks for you reply
PUTFTP “cc.csv”,“cc123”
success%= GETSYS Prg,“ACTIONSTAT”
Print success%
I do with this script .But in case lost connection can not slove ?

My project need send data very one min to sever and update time from to ,
and cover lost connection .
This is why i need check send data is ok ?
Can you give me example ?

Hello,

I do not think you have it correct. As the example shows after you perform your action you would need to run:
actionID% = GETSYS PRG, "ACTIONID"
This gives you the actionID of FTP request

onEvent:
eventId% = GETSYS PRG, "EVTINFO"
IF (eventId% = actionID%) THEN
SETSYS PRG, "ACTIONID", eventId%
stat% = GETSYS PRG, "ACTIONSTAT"
IF (stat% = 0) THEN
//action taken on success

ELSE
//action for failure 
ENDIF
ENDIF
END

Hello
I did not understand the procedure.What is the correct order?

Rem — eWON start section: Cyclic Section
eWON_cyclic_section:
Rem — eWON user (start)
//—
Rem — eWON user (end)
End
Rem — eWON end section: Cyclic Section
Rem — eWON start section: Init Section
eWON_init_section:
Rem — eWON user (start)
TSET 1, 50
ONTIMER 1,"@File_Upload()"

Rem — eWON user (end)
End
Rem — eWON end section: Init Section
Rem — eWON start section: User Section
Rem — eWON user (start)
// Post a file with the Histo logging of Temperature tag
// on a defined FTP server.
Function File_Upload()
a$ = “/Test_Script.csv”
b$ = “[$dtHL$ftT$st_h3$et_m0$tntest1]”
PUTFTP a$, b$

actionID% = GETSYS PRG, “ACTIONID”

onEvent:
eventId% = GETSYS PRG, “EVTINFO”
IF (eventId% = actionID%) THEN
SETSYS PRG, “ACTIONID”, eventId%
stat% = GETSYS PRG, “ACTIONSTAT”
IF (stat% = 0) THEN
//action taken on success

ELSE
//action for failure
ENDIF
ENDIF
END

// Post a file containing the event log
a$ = “/events.txt”
b$ = “[$dtEV]”
PUTFTP a$, b$
Print "OK "
ENDfn

Rem — eWON user (end)
End
Rem — eWON end section: User Section

Where is the label defined?

Mic

Mic,
It looks like you are mixing labels and functions. onEvent: is defining a label, you are most likely getting an error from it being inside a function. After getting the action id you will need to call the on event code to check the status.

Deryck

1 Like

Thank you, now it works after I’ve sorted the functions.
Mic