Click to See Complete Forum and Search --> : File size ?


Sudeep Nayak
May 15th, 2001, 03:58 AM
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.

Iouri
May 15th, 2001, 07:12 AM
Dim filesys As Object
Dim f As Object
Set filesys = CreateObject("Scripting.FileSystemObject")
Set f = filesys.GetFolder(folderpath)
Msgbox f.Size



Iouri Boutchkine
iouri@hotsheet.com

Sudeep Nayak
May 16th, 2001, 01:31 AM
I want to find the file size without downloading the file...

kanarde
December 21st, 2001, 02:54 PM
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