|
hi all,
i was wondering if any one can help me with my problem.
i am trying to upload a txt file from linux box . for that my vb application runs this function( see below) every 1 minute .
first time when it runs it transfers the file correctly but the rest of the time it transfers the file without any errors but when you look at the file its the same as the one transfered on first attemp( i can tell this because the file on the linux box is constantly evey minute or so , appended with new data). i have deleted this file manually on the win pc but still the next time my application uploads the file it the same old one. i have also checked the file on the linux box , its been updated /appended with new data without any fault.
here is the code i am using.
code---
Private Sub doftp(ipadd As String, UserName As String, Password As String, sourceFileName As String, target As String)
On Error GoTo ftperror
Dim lngINet As Long
Dim lngInetConn As Long
Dim blnrc As Boolean
Dim chdirResult As Variant
Dim res As Boolean
lngINet = InternetOpen("FTP", 1, vbNullString, vbNullString, 0) ' opens internet session
If (lngINet <> 0) Then
lngInetConn = InternetConnect(lngINet, ipadd, 0, UserName, Password, 1, 0, 0) ' opens internet session
chdirResult = ChangeDir(lngInetConn, "/usr/log")
blnrc = FtpGetFile(lngInetConn, sourceFileName, target & "\" & sourceFileName, 0, 0, 1, 0)
If (blnrc) Then
MsgBox (" transfer completed ")
Else
MsgBox (" cannot transfer successfully")
End If
call InternetCloseHandle(lngInetConn)
call InternetCloseHandle(lngINet)
Else
MsgBox ("error in connection")
End If
ftperror:
MsgBox (" error in ftp process")
End Sub
----code end ----
many thanks
yoyo73
|