Home » Community » Newbie corner » upload / download
Re: upload / download [message #55151 is a reply to message #55149] |
Wed, 14 October 2020 18:37 |
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
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
|
|
|
Goto Forum:
Current Time: Thu May 16 04:01:23 CEST 2024
Total time taken to generate the page: 0.01938 seconds
|