Recent Posts

Tuesday, April 1, 2008

FTP files from VB 6

Private Sub Command1_Click()
' Simple FTP Sample
' This is written in VB 6. You need to include
' Microsoft Internet Transfer Control 6.0 (MSINET.OCX)
' in your code (referred to as Inet1 in this code).
'Obviously you will need to change the values used below to the
'ones that suit your needs

' First make an FTP Site in IIS for testing and put
' file named pra.htm in the ftp site
' and file named pra.txt in the c:

Inet1.AccessType = icUseDefault
' URL of FTP Site goes here.
Inet1.URL = ""
Inet1.UserName = "db2admin"
Inet1.Password = "commission"

Inet1.RequestTimeout = 40
' GET Command here.
' download pra.htm and place it on c:\pra.htm

Inet1.Execute , "GET pra.htm c:\pra.htm"

'Put Command here.
'Upload c:\pra.txt and place it on FTP Site

'Inet1.Execute , "PUT c:\pra.txt pra.txt"

Do While Inet1.StillExecuting
Inet1.Execute , "CLOSE"
MsgBox ("Update Completed")

End Sub

Related Posts by Categories

No comments:

Post a Comment