-
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
-
Try the .Getheader ;)
Code:
Inet1.OpenURL "www.vbworld.net"
MsgBox Inet1.GetHeader("Content-length")
-
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]
-
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")
...