R
rofloller
Guest
Have fun...
Code:
Private Sub Command1_Click()
Me.Caption = "Uploading..."
If UploadFile("C:\", "file.exe", "admin", "password123", "www.jrantala.com", "crap/") Then
MsgBox "File uploaded succefully"
End If
End Sub
Private Function UploadFile(LocalDir As String, FileName As String, username As String, password As String, FTPserver As String, remoteDir As String)
Inet.Cancel
While Inet.StillExecuting
DoEvents
Wend
On Error GoTo err
Inet.Execute "FTP://" & username & ":" & password & "@" & FTPserver, "SEND " & Chr(34) & LocalDir & FileName & Chr(34) & " " & Chr(34) & remoteDir & FileName & Chr(34)
While Inet.StillExecuting
DoEvents
Wend
Inet.Execute , "CLOSE"
While Inet.StillExecuting
DoEvents
Wend
UploadFile = True
Exit Function
err:
UploadFile = False
MsgBox Error
End Function

