Results 1 to 3 of 3

Thread: Problem with Inet1

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    2

    Problem with Inet1

    when i try to get some file the inet1 get me only half!
    for example: if i have 1mb file it get me only 0.5

    why?

    The code:


    Dim file As String
    Dim file2 As String

    Private Sub Command1_Click()
    file = Inet1.OpenURL("http://www.dr-vb.co.il/files/logo_top1.jpg", icByteArray)
    file2 = Inet1.GetChunk(2048, icString)
    Do While Len(file2) <> 0
    DoEvents
    pb1.Value = pb1.Value + 1
    file = file & file2
    file2 = Inet.GetChunk(2048, icString)
    DoEvents
    Loop


    Open "d:\desk5.jpg" For Binary Access Write As #1
    Put #1, , file

    End Sub
    my english isn't very good..

  2. #2
    Hyperactive Member
    Join Date
    Aug 2002
    Location
    UK
    Posts
    417

    Re: Problem with Inet1

    Hi just found this page may be of some use.

    http://www.codeguru.com/forum/showth...hreadid=220177
    When your dreams come true.
    On error resume pulling hair out.

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    2

    Re: Problem with Inet1

    Its works but! when i try to get file from FTP the program sayd :"This call is not valid for an FTP connection"
    the infected code:

    VB Code:
    1. Size = CLng(Inet1.GetHeader("Content-Length"))

    all the code:


    Private Sub Command1_Click()

    Dim Size As Long, Remaining As Long, FFile As Integer, Chunk() As Byte, file As String
    file = "ftp://nadavsen2[email protected]/1.txt"
    Inet1.Execute file, "GET"

    Do While Inet1.StillExecuting
    DoEvents
    Loop

    Size = CLng(Inet1.GetHeader("Content-Length"))
    Remaining = Size

    FFile = FreeFile
    Open "c:\logo.txt" For Binary Access Write As #FFile
    Do Until Remaining = 0

    If Remaining > 1024 Then
    Chunk = Inet1.GetChunk(1024, icByteArray)
    Remaining = Remaining - 1024

    Else
    Chunk = Inet1.GetChunk(Remaining, icByteArray)
    Remaining = 0

    End If
    Put #FFile, , Chunk
    Loop
    Close #FFile
    MsgBox "File downloaded", vbInformation

    End Sub
    Last edited by Nadavsenior; May 15th, 2006 at 03:42 AM.

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