|
-
Oct 28th, 2009, 02:57 AM
#17
Re: VB6 Download multiple files at once: no API, no extra dependency
Abu Badr: instead of displaying in a textbox you save a file
Code:
Private Sub Downloader1_Complete(URL As String, Data As String, Key As String)
Dim intFF As Integer, bytData() As Byte
Me.Caption = URL
' get a file number
intFF = FreeFile
' place in a byte array
bytData = Data
' open for binary access so every byte is saved the way it is
Open "C:\test.txt" For Binary Access Write As #intFF
Put #intFF, , bytData
Close #intFF
End Sub
This of course always saves to just one file, you need to write your own code to allow saving anywhere you want. Note that this method is not the shortest for "just saving files", there are other ways of doing that, but they're out of the scope of this thread.
Jim Davis: I wasn't talking about saving 2 GB of data to a byte array, I speaked more generally on file downloading. I never download anything that big unless it is a torrent. Also, this method is very simple and does not allow chunks. It is just the same mechanism that Internet Explorer uses to download files, I think.
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
|