Results 1 to 8 of 8

Thread: { RESOLVED } Download a file...

  1. #1

    Thread Starter
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Thumbs up { RESOLVED } Download a file...

    Hi,

    I want to download a file through a program which should be like this...

    VB Code:
    1. Option Explicit
    2.  
    3. Dim strURL As String
    4. Dim strSaveLocation As String
    5.  
    6. Private Sub cmdDownload_Click()
    7.     'Can I use it like this...
    8.     strURL = "http://www.xyz.com/shared/1.zip"
    9.     strSaveLocation = "C:\Temp\..."
    10.     Call DownloadFile(strURL, strSaveLocation)
    11.    
    12.     strURL = "http://www.xyz.com/shared/2.zip"
    13.     strSaveLocation = "C:\Temp\..."
    14.     Call DownloadFile(strURL, strSaveLocation)
    15. End Sub
    16.  
    17. Private Sub DownloadFile(URL As String, SaveLocation As String)
    18.     'Need a code for download
    19. 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.

  2. #2

    Thread Starter
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Thumbs down Hmm...

    * bump *

  3. #3

    Thread Starter
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Thumbs up Hmm...

    OK then...I have solved it...

    Take a look as this attachment...
    Attached Files Attached Files

  4. #4

    Thread Starter
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Angry Hmm...

    not a single reply...!!!

  5. #5
    PowerPoster Pc_Madness's Avatar
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    2,765
    Its cause no one cares and everyone knew that you didn't need any help in solving the problem
    Don't Rate my posts.

  6. #6
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    That's a lot of code, but less dependencies. I would have just used the inet control.

    VB Code:
    1. Dim buff() As Byte
    2. buff = Inet1.OpenURL("http://www.xyz.com/shared/1.zip", icByteArray)
    3. Open "C:\1.zip" For Binary As #1
    4.   Put #1, , buff
    5. Close #1
    <removed by admin>

  7. #7
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    you could have used:

    VB Code:
    1. 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
    2. Public Function DownloadFile(URL As String, LocalFilename As String) As Boolean
    3.     Dim lngRetVal As Long
    4.     lngRetVal = URLDownloadToFile(0, URL, LocalFilename, 0, 0)
    5.     If lngRetVal = 0 Then DownloadFile = True
    6. End Function
    7. Private Sub Form_Load()
    8.     'example by Matthew Gates ([email protected])
    9.     DownloadFile "http://www.allapi.net", "c:\allapi.htm"
    10. End Sub
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  8. #8

    Thread Starter
    ^:^...ANGEL...^:^ wrack's Avatar
    Join Date
    Mar 2002
    Location
    Melbourne, AUSTRALIA
    Posts
    2,695

    Angry I don't think so...

    Originally posted by Pc_Madness
    Its cause no one cares and everyone knew that you didn't need any help in solving the problem
    I think ur name suggests ur nature...I found help from some where else and I don't like to bother someone if I don't have any trouble...

    Give ur self a break from PC's madness...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width