Subscribe to Coding and stuff        RSS Feed
-----

Downloading from FTP in VB6.0

Icon Leave Comment
It is my first blog so dont be so hard on me i lose lots of my time to try get this to work so i decide to share it :)

so here is the code

so we add Inet1
i will show you how to copy a file from FTP

Dim str_url As String
Dim sFTPCommand As String  'the command send to ftp server
Dim sFTPSrcFileName As String ' the name of the file that we search in ftp server
Dim sFTPTgtFileName As String 'optional it is for new name when you copy (you dont have to seth this it will copy it as the name of original)
Dim sFTPUser As String ' the username
Dim sFTPPwd As String ' the password
Dim fWait As Boolean
dim sFTPurl as Strin ' the ip or the url of the FTP serve

sFTPUser=txtUsername.Text
sFTPPwd= txtPassword.Text
str_url="ftp://" & sFTPUser & ":" & sFTPPwd & "@" & sFTPurl
sFTPCommand = "GET" 'the command to FTP server
sFTPSrcFileName = "Version.txt" 'it is the file on the server
sFTPTgtFileName = "Ver.txt" ' it is the name of the file when you copy it on your HDD

' send the line to Inet1 to execute it 

Inet1.Execute str_url, sFTPCommand & Space(1) & sFTPSrcFileName & " " & sFTPTgtFileName

'NOW HERE IS THE TRICK YOU MUST WAIT TO BE SHURE IT IS DONE WITH THIS CYCLE HERE
'
  fWait = True
  Do Until fWait = False
		DoEvents
		fWait = Inet1.StillExecuting
  Loop






and here we go now that you copy your file you can read it and do what ever you want with it now if you want to send to FTP just seth the command to PUT and your done :) i hope you like it :)

0 Comments On This Entry

 

October 2014

S M T W T F S
   1234
567891011
12131415161718
19 20 2122232425
262728293031 

Tags

    Recent Entries

    Search My Blog

    0 user(s) viewing

    0 Guests
    0 member(s)
    0 anonymous member(s)