Results 1 to 4 of 4

Thread: FTP file size

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2000
    Posts
    81
    Hi all,

    I'm trying to ftp a file from a remote server. This file is a zip file so I also want to unzip it. However, the GET action of the INET control returns before the action is complete. I thought this scenario was what the StillExecuting property was for but it doesn't seem to be because 9 times out of 10 StillExecuting is False but the file can't be unzipped. If I wait (say) a minute, it can be unzipped so all I'm waiting for is the file buffer to be flushed or something. Calling DoEvents() doesn't help either.
    Does anyone know how to get the size of a file that's sat on an FTP server? I can get the size of a directory but that's no help. If I know how big the file should be I can write my own little function to wait until it's all there.
    Has anyone else come across this "feature" yet?

    TIA,
    Toot
    Some cause happiness wherever they go; others, whenever they go.

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Try the .Getheader
    Code:
    Inet1.OpenURL "www.vbworld.net"
    MsgBox Inet1.GetHeader("Content-length")
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  3. #3
    Guest
    To get the full file without letting Inet to truncate it:
    Code:
    Dim strFile As String
    Dim strTemp As String
    strFile = Inet1.OpenURL("frp://ftp.site.ext/YourFile.ZIP")
    Do
       strTemp = Inet1.GetChunk(2048)
       strFile = strFile & strTemp
    Loop Until Len(strTemp) = 0
    At the end of this code, strFile should contain the whole file.

    I hope it helps.
    Let me know.

    Scorp

    [Edited by Sc0rp on 10-18-2000 at 12:31 PM]

  4. #4
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    I suggest you download it in a byte array,
    Code:
    Dim strFile() As Byte 
    Dim strTemp As String
    strFile = Inet1.OpenURL("frp://ftp.site.ext/YourFile.ZIP")
    ...
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

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