Results 1 to 5 of 5

Thread: iNet Control Help. Downloading...

  1. #1

    Thread Starter
    Hyperactive Member Asaf_99's Avatar
    Join Date
    Jul 2000
    Location
    Israel
    Posts
    335

    Unhappy

    Hi all!
    I tried to download a file through iNet control. I know the exact location of a file and I want to download it to a folder and show it in a label. Here's a description for the thing I'm trying to do.

    URL: ftp.xoom.com/ultimateam
    Source File: News.txt
    Target File: App.Path & "/History/News/News.txt"

    How can I do this? I beat the hell out of myself trying to figure this out.
    Please help me!
    Any help appriciated!

    ,Asaf Sagi.
    Asaf Sagi

    ICQ: 61917199
    E-Mail: [email protected]

  2. #2
    Hyperactive Member
    Join Date
    Aug 2000
    Posts
    258
    Wow Guess what I Found using "Search"

    Here

    Code:
    Private Sub Command1_Click()
        Dim iFile As Integer
        Dim bBIN() As Byte
        bBIN = Inet1.OpenURL("www.vb-world.net/images/vbworld.gif", icByteArray)
        iFile = FreeFile
        Open "C:\vbworld.gif" For Binary Access Write As iFile
            Put #iFile, , bBIN
        Close iFile
    End Sub
    []P
    Visual Basic 6 SP4 on win98se

    QUIT THE RAT RACE BECAUSE YOUR MESSING THE WORLD UP !!!!!

  3. #3

    Thread Starter
    Hyperactive Member Asaf_99's Avatar
    Join Date
    Jul 2000
    Location
    Israel
    Posts
    335

    Unhappy

    Thanks Private1, it works fine with the gif but when I download a textfile which called News.txt and contains in it only "mana" so it downloads it and shows me tons of HTML crap.
    Any suggestions?
    Asaf Sagi

    ICQ: 61917199
    E-Mail: [email protected]

  4. #4

    Thread Starter
    Hyperactive Member Asaf_99's Avatar
    Join Date
    Jul 2000
    Location
    Israel
    Posts
    335
    Anyone?
    This can't be that hard or something...
    Besides, this is very important...

    Still many thanks for any help!
    Asaf Sagi

    ICQ: 61917199
    E-Mail: [email protected]

  5. #5
    Guest
    That's because it's protocol is icByteArray which is for downloading pictures and images. Change it to icString which is for text.

    Code:
    Private Sub Command1_Click()
         Dim x As String
         x = Inet1.OpenURL("http://forums.vb-world.net", icString)
         ReturnStr = Inet1.GetChunk(2048, icString)
         Do While Len(ReturnStr) <> 0
         DoEvents
         x = x & ReturnStr
         ReturnStr = Inet1.GetChunk(2048, icString)
         Loop
    End Sub
    Or you can also use the URLDownloadToFile api function to download it to a file. Take a look at this tip from Vb-World that will show you how and open it.

    The reason why you should use the URLDownloadToFile api function as an alternative is because MSInet is very unreliable. Very buggy (times out) and doesn't get the whole page sometimes, just half.

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