Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » upload / download
Re: upload / download [message #55151 is a reply to message #55149] Wed, 14 October 2020 18:37 Go to previous messageGo to previous message
Oblivion is currently offline  Oblivion
Messages: 1094
Registered: August 2007
Senior Contributor
Hello BetoValle

The example below shows how to download a file (with a progress bar).
The file is small, so the progress bar will only show up briefly.

#include <CtrlLib/CtrlLib.h>
#include <plugin/ftp/ftp.h>

using namespace Upp;

GUI_APP_MAIN
{
	FtpClient ftp;
	if(ftp.Connect("test.rebex.net", "demo", "password")) {
		Progress pi(nullptr, "Download");
		pi.Create();
		ftp.WhenProgress << [&pi](int done, int total)
		{
			pi.SetText(Format(t_("%1:s of %2:s is transferred"),
				FormatFileSize(done),
				FormatFileSize(total)));
			return pi.SetCanceled(done, total); // Adds a cancel button and cancels the download if the button is clicked...
		};
		RDUMP(ftp.Load("readme.txt"));
	}
}



Best regards,
Oblivion


 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Shrila Prabhupada Sanskrit Slovary
Next Topic: "simple" connection and operation with database
Goto Forum:
  


Current Time: Thu May 16 04:01:23 CEST 2024

Total time taken to generate the page: 0.01938 seconds