Project

General

Profile

Bug #1043 » HuUpload.cpp

Jan Hrubeš, 10/31/2011 11:22 PM

 
#include <Wt/WApplication>
#include <Wt/WFileUpload>
#include <Wt/WProgressBar>
#include <Wt/WText>
#include <Wt/WContainerWidget>



using namespace Wt;

class HuUpload : public WApplication
{
private:
WFileUpload *fu_;
void fileUploaded();
public:
HuUpload(const WEnvironment& env);
virtual ~HuUpload();
};

HuUpload::~HuUpload()
{
}

HuUpload::HuUpload(const WEnvironment& env)
: WApplication(env)
{
fu_ = new WFileUpload( root() );
fu_->setProgressBar(new WProgressBar());
fu_->changed().connect(fu_, &WFileUpload::upload);
fu_->uploaded().connect(this, &HuUpload::fileUploaded);
}

void HuUpload::fileUploaded()
{
//this will newer happen in Opera
root()->addWidget(new WText(" Done. "));
}



WApplication *createApplication(const WEnvironment& env)
{
return new HuUpload(env);
}


int main(int argc, char **argv)
{
return WRun(argc, argv, &createApplication);
}

    (1-1/1)