Retrieve a FTP file size!


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Page 1 of 2 12 LastLast
Results 1 to 15 of 17

Thread: Retrieve a FTP file size!

  1. #1
    Join Date
    Apr 2005
    Location
    South Africa
    Posts
    88

    Question Retrieve a FTP file size!

    I am busy writing a FTP app with VB6, how can I retrieve the file size of a file on the FTP site.
    I need this to use a Progress bar to show how far the download process is!
    Just shout if you need any code!

    Thanks for you're help in advance!
    Regards

  2. #2
    Join Date
    Dec 2003
    Posts
    2,750
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  3. #3
    Join Date
    Apr 2005
    Location
    South Africa
    Posts
    88
    That is basically what I want but they do not explain anything so its quite difficult for me to implement the code (only for the file size) into my program.
    Any suggestions?

    Thanks for you're help!

  4. #4
    Join Date
    Dec 2003
    Posts
    2,750
    You may want to indicate what you are using for FTP. Are you using the Microsoft Internet Controls or something else?
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  5. #5
    Join Date
    Nov 2004
    Location
    Huddinge, Sweden
    Posts
    283
    Essentially you use the "dir" command to find out the file size.

    Rune
    If you hit a brick wall, you didn't jump high enough!

  6. #6
    Join Date
    Apr 2005
    Location
    South Africa
    Posts
    88
    I am using "wininet.dll", the same as the program you gave me!
    I tried using the dir but it gave me an access denied error or something, it worked for my local files though!

    I don't know what I code I should give you couse its quite alot!

  7. #7
    Join Date
    Dec 2003
    Posts
    2,750
    I took a look at the example I referred to and it doesn't appear to do what you are asking, contrary to what the MS KB article states.

    I did find another example that looks to be complete:

    http://www.vbip.com/protocols/ftp/vb...utorial-04.asp

    However, there is one bug that I uncovered, but all it needs is a small fix. Just change the following line of code in the Sub m_objFtpClient_OnEnumFiles from:

    objListIetm.SubItems(1) = Format$(objFtpFile.FileSize, "### ### ###")

    to:

    objListIetm.SubItems(1) = Format$(objFtpFile.FileSize, "###,###,###")

    ...and then the progress bar should work correctly.
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  8. #8
    Join Date
    Apr 2005
    Location
    South Africa
    Posts
    88

    Question

    Hi there,
    I tried everything, but just can't get it to work.
    First off all I am using a treeview instead of a listview and everything is just so confusing when it comes to all the Classes like m_objFtpClient and m_objFtpFile.
    I do not have any classes and I can download files already.
    Our code is just so different so I do not know how to implement it!

    Any suggestions!

    Thanks for you're help man,
    I really appreciate it!!!

    GermanD

  9. #9
    Join Date
    Apr 2005
    Location
    South Africa
    Posts
    88
    Please help!!!

  10. #10
    Join Date
    Dec 2003
    Posts
    2,750
    You may want to post your project files because we have no way of knowing how to apply the examples posted to what you currently have.
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  11. #11
    Join Date
    Apr 2005
    Location
    South Africa
    Posts
    88

    My Project

    I will send my project filees when I took out some images because my program is too big to upload. Will probably upload tomorrow!

  12. #12
    Join Date
    Apr 2005
    Location
    South Africa
    Posts
    88

    My Project Files

    Here are my project files!
    I have removed a few things to make the files smaller!

    Thanks for your help!
    Attached Files Attached Files

  13. #13
    Join Date
    Apr 2005
    Location
    South Africa
    Posts
    88
    Are you managing to get the filesize of the ftp file with my project?
    Thanks man!
    GermanD
    deonmeyer@gmail.com
    ** <<]db[>> **
    *** G.s.G Crew ***

  14. #14
    Join Date
    Dec 2003
    Posts
    2,750
    I downloaded your project but haven't had the time to look at it yet. I'll try to get to it in the next couple of days.
    Paul
    ~~~~
    Microsoft MVP (Visual Basic)

  15. #15
    Join Date
    Apr 2005
    Location
    South Africa
    Posts
    88
    Hi, sorry to bug you again, just wanted to
    know how it is going with the ftp file size project!

    thanks alot,
    regards
    GermanD
    deonmeyer@gmail.com
    ** <<]db[>> **
    *** G.s.G Crew ***

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center