|
-
Sep 7th, 2000, 10:53 PM
#1
Thread Starter
Junior Member
Hi,
I've been trying to download binary files, mainly gifs, using the Internet Transfer Control. I am using the code that is in the Help for VB 5.0:
Inet1.AccessType = icUseDefault
Dim b() As Byte
Dim strURL As String
' Presuming this is still a valid URL.
strURL = "ftp://ftp.microsoft.com/" & _
"developr/drg/Win32/Autorun.zip"
' Retrieve the file as a byte array.
b() = Inet1.OpenURL(strURL, icByteArray)
Open "C:\Temp\Autorun.zip" For Binary Access _
Write As #1
Put #1, , b()
Close #1
MsgBox "Done"
I have changed the code to download gif files from my web site and other web sites, but about 25% of the time the gif that is downloaded is corrupted, which means the gif looks sort of like it should, but the pixels are out of place.
Does anyone know how to fix this, or has anyone else had this problem?
Thank you for any help you can give.
-
Sep 8th, 2000, 02:19 AM
#2
Lively Member
Try this way:
Public Sub FtpConnect()
Inet1.AccessType = icUseDefault
Inet1.Protocol = icFTP
Inet1.URL = "ftp.microsoft.com"
Inet1.UserName = "anonymous"
Inet1.Password = "[email protected]"
Inet1.RemotePort = 21
Inet1.RequestTimeout = 60
Inet1.Execute , "CD developr/drg/Win32"
Do
DoEvents
Loop While Form1.Inet.StillExecuting
FtpGetFile
Inet1.Execute , "QUIT"
Do
DoEvents
Loop While Inet1.StillExecuting
End Sub
Public Sub FtpGetFile()
Dim GetFile as String
GetFile = "AutoRun.zip"
Inet1.Execute , "GET " & GetFile & " " & "C:\Temp\" & GetFile
Do
DoEvents
Loop While Inet1.StillExecuting
End Sub
Hope this helps you.
Or look here:
http://www.vbsquare.com/internet/inet1/
http://www.vbsquare.com/internet/inet2/
http://www.vbsquare.com/internet/inet3/
-Dj4
-
Sep 8th, 2000, 03:55 PM
#3
Thread Starter
Junior Member
I'm trying to download from an http site, for example: http://slimticker.hypermart.net/prev40.gif
-
Sep 11th, 2000, 12:08 PM
#4
Hyperactive Member
To dj4:
Each time I tried using the ITC, I had the same problem: I get an infinite loop.
Do
DoEvents
Loop While Form1.Inet.StillExecuting
After connecting to the URL (ftp, in my case), the loop will never end. And I am 100% sure it is succesfully connected to the ftp.
Why is this happening?!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|