7.3 - Uploading Data Using FTP (Applies to T-Series and UD-Series)
Uploading data using DAQFactory FTP is very similar to Email. The variables are slightly different and all start with FTP, but the general concept is the same. You'll obviously need to know your FTP server address, user name and password. To demonstrate, we'll use the email attachment example we did at the end of the last section and change it to do FTP instead, including all the initialization code too:
ftp.strServer = "ftp.myServer.com"
ftp.strUserName = "ftpUser"
ftp.strPassword = "password"
logging.mylog.strFileName = "c:\mydata_" + formatdatetime("%y%m%d",systime()) + ".csv"
private string lastdate = formatdatetime("%d",systime())
while(1)
if (formatdatetime("%d",systime() != lastdate))
// save the attachment file BEFORE we change the logging set name ftp.strLocalFile = logging.mylog.strFileName
ftp.strRemoteFile = logging.mylog.strFileName // you may need to change this if your server doesn't like logging.mylog.strFileName = "c:\mydata_" + formatdatetime("%y%m%d",systime()) + ".csv"
// give the logging set time to close yesterday's file before we send the email
delay(10)
ftp.Upload()
endif
delay(1)
endwhile