Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Best and easiest way to FTP files giving a progress status

Posted on 2003-12-01
20
1,844 Views
Last Modified: 2013-11-13
I've read that one can't display a progress status using the Inet1 control.  If that's true, what's the best and easiest way to FTP files (put/get) and be able to display a status?  Some of the files I need to transfer can will be very large.

Sample code would be appreciated.

Thanks.
0
Comment
Question by:halfondj
  • 8
  • 7
  • 4
  • +1
20 Comments
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9852402
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9852405
0
 

Author Comment

by:halfondj
ID: 9852445
Thanks, but I've looked at both samples.  The first one doesn't provide an upload way and the second is quite complicated.

Any other suggestions?
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9852478
Yes, you are right, it only shows download part.
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 9852833
You can always get down and dirty and use the Winsock Control.  You will need one for the control connection and one for the data connection.  Then you can manage EVERY aspect of your FTP session and upload/downloads with full resume capability and progress bars.

No, it is not a trivial matter. =)

...but there are tons of examples out there.

Idle_Mind
0
 

Author Comment

by:halfondj
ID: 9852906
IDle_Mind:  Thanks, but I would like something simple.
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 9852929
I wrote a generic ftp upload/download utility designed to be called from within other applications, with the ability to resume transfers and grab multiple files based upon a file mask.  It had active/passive modes and all the bells and whistles.

It ended up being over 3000 lines of code.

We were dealing with very large files (medical imaging files and database files) where status and resume capability was very important.

There are many examples of how to download a file with very few lines of code but they don't have error correction, status bars, or resume capability.

In short, if you want nice features, your going to have invest some time and use complicated code.

Good Luck,

Idle_Mind
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9852936
Well, simply things have simple features...

Take a look at this excelent tutorial (not control but wininet API):
http://www.vbip.com/protocols/ftp/vb-ftp-client-library/tutorials/tutorial-01.asp
and subsequents chapters
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9852947
0
 

Author Comment

by:halfondj
ID: 9852960
The majority of the time, the files will be small and therefore, I don't think I need the resume capability.

I do need someway to communicate to the user that a download or upload is taking place.

I've search EE and read every article re:inet progress bar ftp.

Any additional suggestions/sample code would be greatly appreciated!

Thanks.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9852980
Then, If you don't need to show progress, a simple text in the caption (showing start/stop of both actions) in the main form would be enought.
0
 

Author Comment

by:halfondj
ID: 9852984
Is it advisable to use Inet1 or should I consider connecting/FTPing a different way via VB?
0
 

Author Comment

by:halfondj
ID: 9853001
If I can, I would like to show a progress bar.
0
 
LVL 3

Expert Comment

by:Basker
ID: 9854765
You can use the Inet control for ftp uploading, The way to do it

 download
       Inet1.URL = "ftp://ftp.private.com"
        Inet1.UserName = "George Washington"
        Inet1.Password = "no_lies"
        Inet1.Execute , "GET source.txt C:\target.txt"

upload
         Inet1.URL = "ftp://ftp.private.com"
        Inet1.UserName = "George Washington"
        Inet1.Password = "no_lies"
        Inet1.Execute , "CD gifs\thegifs"
        Inet1.Execute , "PUT C:\source.txt target.txt"
        Inet.Execute ,"CLOSE"

store the results in byte array

Regarding displaying progress, when you start to upload you know the file size, get the connectiong speed, and make your own calculation to display the progress bar.
0
 

Author Comment

by:halfondj
ID: 9857603
Again, is it advisable to use Inet1 or should I consider connecting/FTPing a different way via VB?
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 9857641
halfondj,  Basker is showing an example code using inet control...!!
Also, it appears that you are opened to other ways to achieve that but as sonn as we post some diferent, you refuse them!
0
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 9858634
Basker,

"Regarding displaying progress, when you start to upload you know the file size, get the connectiong speed, and make your own calculation to display the progress bar."

Hate to bust your bubble Basker, but connection speeds can vary greatly from the time you start your transfer.  The internet is a wild place.  If the connection is terminated (gasp...that could never happen!), then you will happily go along updating progress while nothing is actually being sent/received.

Idle_Mind
0
 

Author Comment

by:halfondj
ID: 9859452
Richie_Simonetti:  I asked which is a better way.  That was the key question.  Also, my original question re:adding a progress bar or similiar was not completely answered.  As you see, Idle_Mind pointed out a problem w/Basker's answer.

Since I don't have experience and it seems like you and others do, I'll ask again -- which is a better and more efficient way for performing FTP uploads/downloads, Inet1 or the more complicated way?

As soon as a solid answer is provided, I'll be more than happy to accept an answer.

Thanks again for your time!!
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 125 total points
ID: 9859643
Alrighty halfondj,

I have searched high and low for ways to give a progress bar using the INET control while downloading AND uploading and haven't found anything.

There is a thread here which deals with the same topic:
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_20408606.html

So in my opinion, IF YOU MUST have progress bars then the INET control is NOT the way to go.
The code will be infinitely more complex, but use the Winsock Control.  Complexity is the price you pay for robustness.

However, you state:
"...which is a better and more efficient way for performing FTP uploads/downloads..."

INET is more efficient in the respect that the code is smaller.
Winsock is more efficient in that you have more control over the transfer.

As I said before:

"In short, if you want nice features, your going to have invest some time and use complicated code."

Regards,

Idle_Mind
0
 

Author Comment

by:halfondj
ID: 9859961
Thank you all for responding.  I just wanted to know from VB programmers more experienced than I am re:the more efficient way of performing FTP functions.

I had also researched the Internet re:this topic and couldn't come up w/anything re:Inet w/a progress bar, but I wanted to get other opinions re:other FTP implementations.

Thanks again!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question