Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Ftp (remote file download problem)

hi all,

i am using Microsoft Internet Transfer Control 6.0 (MSINET.OCX) in
visual basic 6 with a name Inet1 and trying to download file from my ftp server .
code is given below.
this code do gave any error but also do save the file to my
local computer drive.
any help is highly appericated.

Private Sub cmdcheck_Click()

Inet1.AccessType = icUseDefault
' URL of FTP Site goes here.
Inet1.URL = "ftp://10.132.3.190"
Inet1.UserName = "anonymous"
Inet1.Password = "vbtest@cri.com"

Inet1.RequestTimeout = 40
' GET Command here.
' download welcome.txt and place it on c:\welcome.txt
Inet1.Execute , "GET welcome.txt c:\welcome.txt"
Do While Inet1.StillExecuting
DoEvents
Loop
Inet1.Execute , "CLOSE"
MsgBox ("Download Completed")
End Sub
[905 byte] By [atta-ur-rehman] at [2007-11-11 10:01:44]
# 1 Re: Ftp (remote file download problem)
If you use the .Execute method, you must use the .GetChunk method in the control's StateChanged event to get the downloaded data and write it to a file: http://www.google.com/search?q=internet+transfer+control+execute

Alternatively, you may use the .OpenURL method to download an entire file (up to 64K) in a single operation. OpenURL returns an array of bytes; you are still responsible for writing the data to disk: http://www.google.com/search?q=internet+transfer+control+openurl
Phil Weber at 2007-11-11 17:23:25 >