Aug 30th, 2002, 06:31 AM
#1
Thread Starter
^:^...ANGEL...^:^
{ RESOLVED } Download a file...
Hi,
I want to download a file through a program which should be like this...
VB Code:
Option Explicit
Dim strURL As String
Dim strSaveLocation As String
Private Sub cmdDownload_Click()
'Can I use it like this...
strURL = "http://www.xyz.com/shared/1.zip"
strSaveLocation = "C:\Temp\..."
Call DownloadFile(strURL, strSaveLocation)
strURL = "http://www.xyz.com/shared/2.zip"
strSaveLocation = "C:\Temp\..."
Call DownloadFile(strURL, strSaveLocation)
End Sub
Private Sub DownloadFile(URL As String, SaveLocation As String)
'Need a code for download
End Sub
what do u think...is this possible...I have no idea what kinda control to use...
Last edited by wrack; Aug 30th, 2002 at 11:15 PM .
Aug 30th, 2002, 07:33 AM
#2
Thread Starter
^:^...ANGEL...^:^
Hmm...
Aug 30th, 2002, 08:11 AM
#3
Thread Starter
^:^...ANGEL...^:^
Hmm...
OK then...I have solved it...
Take a look as this attachment...
Attached Files
Aug 30th, 2002, 11:15 PM
#4
Thread Starter
^:^...ANGEL...^:^
Hmm...
Aug 30th, 2002, 11:49 PM
#5
Aug 31st, 2002, 12:08 AM
#6
PowerPoster
That's a lot of code, but less dependencies. I would have just used the inet control.
VB Code:
Dim buff() As Byte
buff = Inet1.OpenURL("http://www.xyz.com/shared/1.zip", icByteArray)
Open "C:\1.zip" For Binary As #1
Put #1, , buff
Close #1
Aug 31st, 2002, 12:19 AM
#7
The picture isn't missing
you could have used:
VB Code:
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" (ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal dwReserved As Long, ByVal lpfnCB As Long) As Long
Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
Dim lngRetVal As Long
lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
If lngRetVal = 0 Then DownloadFile = True
End Function
Private Sub Form_Load()
DownloadFile "http://www.allapi.net", "c:\allapi.htm"
End Sub
Remember, if someone's post was not helpful, you can always rate their post negatively
.
Aug 31st, 2002, 08:21 AM
#8
Thread Starter
^:^...ANGEL...^:^
I don't think so...
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