Private Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" _
(ByVal hFtpSession As Long, ByVal lpszLocalFile As String, _
ByVal lpszRemoteFile As String, ByVal dwFlags As Long, _
ByVal dwContext As Long) As Boolean
Private Sub Command3_Click()
textdati = ""
Form1.Text1 = textdati
lngINet = InternetOpen("MyFTP Control", 1, vbNullString, vbNullString, 0)
If lngINet = 0 Then Form1.Text1 = "Inizializzazione fallita" Else Form1.Text1 = "Inizializzazione OK"
lngINetConn = InternetConnect(lngINet, "ftp.webalice.it", 0, _
"xxxxxxx", "xxxxxx", 1, 0, 0)
textdati = Form1.Text1 & Chr$(13) & Chr$(10) & Chr$(13) & Chr$(10)
If lngINetConn = 0 Then Form1.Text1 = textdati + "Connessione fallita" Else Form1.Text1 = textdati + "Connesso !"
blnRC = FtpPutFile(lngINetConn, "c:\htm\1.txt", "1.txt", 1, 0)
textdati = Form1.Text1 & Chr$(13) & Chr$(10) & Chr$(13) & Chr$(10)
If blnRC = False Then Form1.Text1 = textdati + "File non trovato" Else Form1.Text1 = textdati + "Il file è stato aggiornato OK"
InternetCloseHandle lngINetConn
InternetCloseHandle lngINet
textdati = Form1.Text1 & Chr$(13) & Chr$(10) & Chr$(13) & Chr$(10)
Form1.Text1 = textdati + "by" & Chr$(13) & Chr$(10) + "Goodbye"
End Sub