CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: File size ?

  1. #1
    Join Date
    May 2001
    Posts
    4

    File size ?

    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.


  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: File size ?

    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]
    Iouri Boutchkine
    [email protected]

  3. #3
    Join Date
    May 2001
    Posts
    4

    Re: File size ?

    I want to find the file size without downloading the file...


  4. #4
    Join Date
    Dec 2001
    Posts
    1

    Re: File size ?

    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


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

Featured