Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP uploads progessbar 1

Status
Not open for further replies.

ChrisRChamberlain

Programmer
Mar 23, 2000
3,392
GB
Hi all

Need to create a progressbar to monitor the progress of an FTP upload(s).

The technique employed for the alternative FTP download is to determine the size of the file on the FTP server by using WinAPI call FtpOpenFile() followed by FtpGetFileSize().

Two VFP apps then run side by side - the first attempts to open the target download file with FOPEN() and monitors the filesize through ADIR() whilst in the same DO WHILE loop.

The second runs the download using FtpGetFile() to the local drive.

Knowing the orginal filesize on the FTP server and the current filesize enables the progressbar to display the percentage download.

Same technique can be employed for monitoring the copying of files on local drives - describes an alternative method.

However in the FTP upload situation, unless you can open the uploading file with FptOpenFile(), you can't retrieve the filesize with FtpGetFileSize(), which in turn means you don't have a value to express in the progressbar.

Ideas anyone?

TIA

FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.com
PDFcommandertm.co.uk
 
Chris

However in the FTP upload situation, unless you can open the uploading file with FptOpenFile(), you can't retrieve the filesize with FtpGetFileSize(), which in turn means you don't have a value to express in the progressbar.

I'm confused. Upload to me means you are sending a file TO the FTP site. Why would you use FtpGetFileSize() which is a function to determine the size of the file that is already ON the FTP server. Can you clarify?


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Hi Mike

Thanks for your reply.

As you upload the file to the FTP server, you need to know what size it is at any stage in the upload process in order to be able to refresh the progressbar with a value expressed as a percentage.

In pseudo code, (current size / known complete size * 100).

The file ftp_class.zip contains code that allows a folder listing.

Yet to try it, but it may be possible to retrieve the file size on the FTP server in a DO WHILE loop during the upload process and thus perform the calculation as in previous paragraph.




FAQ184-2483 - answering getting answered.​
Chris [pc2]
PDFcommandertm.com
PDFcommandertm.co.uk


 
A quick search at MSDN shows another API function, InternetWriteFile that has the functionality you need.


Gerardo Czajkowski
ltc.jpg
 
ChrisRChamberlain said:
It also has a companion function InternetReadFile() for downloading.

Yes, the method from Foxite you previously mentioned seems to use this function, and if you read the last post on that thread the author claims to have the wrapper code for InternetWriteFile also. The post is quite old but maybe he can help you.

Gerardo Czajkowski
ltc.jpg
 
If it isn't now company proprietary... I'd really like to see how to show the progress bar for upload/download....

- Bill

Get the best answers to your questions -- See FAQ481-4875.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top