Project

General

Profile

Bug #799 ยป main.cpp

main.cpp - Marco Poletti, 04/20/2011 05:01 PM

 

#include <string>
#include <Wt/WApplication>
#include <Wt/WLogger>
#include <Wt/WFileUpload>
#include <Wt/WContainerWidget>
#include <Wt/WDialog>
#include <Wt/WText>
#include <Wt/WPushButton>
#include <boost/lexical_cast.hpp>

using namespace Wt;

class MyApplication : public WApplication {
public:
MyApplication(const WEnvironment& environment)
: WApplication(environment) {
WFileUpload* fileUpload = new WFileUpload();
fileUpload->changed().connect(fileUpload, &WFileUpload::upload);
fileUpload->fileTooLarge().connect(this, &MyApplication::handleFileTooLarge);
root()->addWidget(fileUpload);
}

void handleFileTooLarge(int size) {
wApp->log("debug") << "File too large! size = "
+ boost::lexical_cast<std::string>(size);
}
};

WApplication *createApplication(const WEnvironment& environment) {
return new MyApplication(environment);
}

int main(int argc, char *argv[]) {
return WRun(argc, argv, &createApplication);
}
    (1-1/1)