1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
#include <QCoreApplication>
#include <QxtWebCore>
#include <QxtWebController>
#include <QxtFcgiConnector>
#include <QTimer>
class test : public QxtWebController
{
Q_OBJECT
public:
test():QxtWebController("root")
{
}
public slots:
int index()
{
echo()<<
"<form method='POST' enctype='multipart/form-data' action='/root/upload'>"
"File to upload: <input type=file name=upfile><br>"
"Notes about the file: <input type=text name=note><br>"
"<br>"
"<input type=submit value=Press> to upload the file!"
"</form>";
return 0;
}
int upload()
{
QByteArray d= QxtWebCore::content(100000000);
QxtWebCore::sendHeader();
QByteArray io;
QxtWebCore::socket()->write(d);
return 0;
}
};
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QxtWebCore core(new QxtFcgiConnector());
core.start();
test t;
return app.exec();
}
#include "main.moc"
|