Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

FTP sending and appending the file


TaCaPica Sep 23, 2021 09:19 AM

Hi there

For several times i have tryed to send FTP files with the append option on it. I even created a pre-file on my FTP folder with the same name but i cant get it to work. I used the example on CRBasic as a base:

ResultFTP_Dados_30m_PA_1 = FTPClient (Server ,User,Pass,"Dados_30m_PA_1","/LOGGER01/Dados_30m_PA_1",8,0,0,Min,-1008,2000)
ResultFTP_Dados_30m_PB1_2 = FTPClient (Server ,User,Pass,"Dados_30m_PB1_2","/LOGGER01/Dados_30m_PB1_2",8,0,0,Min,-1008,2000)
ResultFTP_Dados_30m_PA_3 = FTPClient (Server ,User,Pass,"Dados_30m_PA_3","/LOGGER01/Dados_30m_PA_3",8,0,0,Min,-1008,2000)

(i use several data files)

Any toughts on this?

Regards


JDavis Sep 24, 2021 09:39 PM

Most commonly when FTPClient is able to create a data file, but not append, the permissions on the FTP server are not set appropriately. 

The FTP account used by the datalogger needs permission to read directory contents to know a file already exists. The account also needs permission for append, not just write.


Sam Sep 26, 2021 11:54 PM

The PutGetOption used is "8" which indicates "FTP - Append data to end of file, active mode".

Though we do offer Active and Passive connection modes, Active mode is not commonly used as it requires the server to make a connection back to the client (the datalogger in this case). Passive connections are much more commonly used as both the command and data connections are initiated by the client.

I suggest that you switch to using PutGetOption of "9".

We should revise our help and examples.


Salman Faisal Oct 9, 2021 06:17 AM

Hi,

I have recently tested FTP append option it worked perfectly, What i like most is i didn't lose the data if FTP server is down, when FTP is available all previous data is restored in output file once FTP is back online.

'-------------------------------------------------------------------------------------------------------------------------------------------------------

'CR3000 Series Datalogger

'Date: 30-Sept-2021
'Program author: Salman Faisal Syed

'Declare Public Variables
'Example:
Public PTemp, Batt_volt, FTPResult

'Define Data Tables.
DataTable (Test,1,-1) 'Set table size to # of records, or -1 to autoallocate.
DataInterval (0,15,Sec,10)
Minimum (1,Batt_volt,FP2,False,False)
Sample (1,PTemp,FP2)
EndTable

'Main Program
BeginProg
Scan (1,Sec,0,0)
PanelTemp (PTemp,60)
Battery (Batt_volt)

'Call Output Tables
CallTable Test
NextScan
SlowSequence
Do
Delay(1,10,Sec)
'Create file named FTP_Tutorial_1.csv and append data to the file every 1 minute
FTPResult=FTPClient ("10.100.10.200", "ftp-user", "user", "Test", "FTP_Tutorial_1.csv", 9, 0,1, Min, -1008)
Loop
EndProg

'-------------------------------------------------------------------------------------------------------------------------------------------------------

In my FTP server i have created an User as ftp-user and password is user

For this user in permission i allowed Full control of the define FTP drive.

Log in or register to post/reply in the forum.