How can i find the filesize of a file , say "http://www.yahoo.com/something.exe" from vb ? Please help as i am a beginner.
Printable View
How can i find the filesize of a file , say "http://www.yahoo.com/something.exe" from vb ? Please help as i am a beginner.
Dim filesys As Object
Dim f As Object
Set filesys = CreateObject("Scripting.FileSystemObject")
Set f = filesys.GetFolder(folderpath)
Msgbox f.Size
Iouri Boutchkine
[email protected]
I want to find the file size without downloading the file...
Here you go, gets the size of a file w/o downloading the file. Using Internet Transfer Control.
Private Sub Command1_Click()
Inet1.URL = "http://www.yahoo.com/something.exe"
Inet1.Execute , "HEAD"
End Sub
Private Sub Inet1_StateChanged(ByVal State As Integer)
Dim DocSize As Long
Select Case State
Case icResponseCompleted
If Len(Inet1.GetHeader("Content-Length")) > 0 Then
DocSize = CLng(Inet1.GetHeader("Content-Length"))
Text1.Text = DocSize ' <----- This puts the Size of the file in a text box
End If
End Select
End Sub