Sub send_logs_ftp
Dim lfile As String
lfile = $"iSOS_${mod_functions.make_date_string(DateTime.Now)}_${APPSET.IMEI}.log"$
' // cleanup filename
lfile = lfile.Replace("/",".")
lfile = lfile.Replace(":",".")
lfile = lfile.Replace(" ","_")
mod_functions.writeLog($"Sending log file ${lfile}"$)
Try
' // create log file name
File.Copy(File.DirDocuments,"vsos.log",File.DirDocuments,lfile)
Dim ftp As FTP
ftp.Initialize("ftp", "xxxxx.islesystems.com", 21, "xxxxx", "xxxxxxx")
ftp.PassiveMode = True
Dim sftp As Object = ftp.UploadFile(File.DirDocuments, lfile, True, "/" & lfile)
Wait For (sftp) ftp_UploadCompleted (ServerPath As String, Success As Boolean)
If Success Then
mod_functions.writeLog($"${ServerPath} was uploaded successfully"$)
hd.ToastMessageShow("File was uploaded successfully",False)
Else
mod_functions.writeLog($"${ServerPath} - Error uploading file"$)
hd.ToastMessageShow("Error uploading file",False)
End If
File.Delete(File.DirDocuments,lfile)
ftp.SendCommand("QUIT","") <- this is new to see if the connection gets closed, but same issue.
Catch
mod_functions.writeLog($"send_logs::Error - ${LastException.Message} "$)
End Try
End Sub