WFileUpload, WProgressBar and --max-memory-request-size 5000000
Added by Lamiel Toch over 7 years ago
Hello,
I'm facing a problem with Wt 3.3.6 Compiled with Visual Studio 2013,
When I upload file (about 1Mb), the server crashes if I use in the command line argument ---max-memory-request-size 5000000.
But if I do not specify ---max-memory-request-size, the server does not crash.
I need to specify ---max-memory-request-size without having the server crash.
May you help me ?
best regards.
Lamiel
#include <WT/WServer>
#include <Wt/WTableView>
#include <Wt/WStandardItemModel>
#include <Wt/WApplication>
#include <Wt/WEnvironment>
#include <Wt/WBootstrapTheme>
#include <Wt/WCssTheme>
#include <Wt/WHBoxLayout>
#include <Wt/WProgressBar>
#include <Wt/WPushButton>
#include <Wt/WDialog>
#include <Wt/WFileUpload>
using namespace Wt;
class TestServer : public WApplication
{
public:
TestServer(const WEnvironment& env);
virtual ~TestServer();
protected:
};
WApplication *createApplication(const WEnvironment& env)
{
/*
* You could read information from the environment to decide whether
* the user has permission to start a new application
*/
return new TestServer(env);
}
int main(int argc, char *argv[])
{
//QApplication app(argc, argv);
return Wt::WRun(argc, argv, &createApplication);
return 0;
}
TestServer::TestServer(const WEnvironment &env) : WApplication(env)
{
std::cerr << "=============================>TestServer" << std::endl;
Wt::WBootstrapTheme *bootstrapTheme = new Wt::WBootstrapTheme(this);
bootstrapTheme->setVersion(Wt::WBootstrapTheme::Version3);
bootstrapTheme->setResponsive(true);
setTheme(bootstrapTheme);
//setCssTheme("polished");
useStyleSheet("style/everywidget.css");
useStyleSheet("style/dragdrop.css");
useStyleSheet("style/combostyle.css");
useStyleSheet("style/pygments.css");
useStyleSheet("style/layout.css");
WProgressBar* bar = new WProgressBar();
WFileUpload* fileUpload = new WFileUpload(root());
fileUpload->setFileTextSize(20000);
fileUpload->setProgressBar(bar);
fileUpload->changed().connect(std::bind([=]() {
std::cerr << ">>>>>>>>>>>>>>>>>upload" << std::endl;
fileUpload->upload();
}));
fileUpload->uploaded().connect(std::bind([=]() {
std::cerr << ">>>>>>>>>>>>>>>>>uploaded" << std::endl;
}));
}
TestServer::~TestServer()
{
}
Replies (3)
RE: WFileUpload, WProgressBar and --max-memory-request-size 5000000 - Added by Wim Dumon over 7 years ago
I just tested this in wt 4 with a 1MB and a 10MB file upload and it works.
What is your test case?
Can you add a stack trace to your bug report?
Best regards,
Wim.
RE: WFileUpload, WProgressBar and --max-memory-request-size 5000000 - Added by Lamiel Toch over 7 years ago
Hello,
Thank you very much for your answer.
I'm using Wt 3.3.6 (not Wt 4) and a file which is 1133 KBytes heavy (galaxy-wallpaper-27).
I attached the test file and the stack trace in Qt (Windows/Visual Studio 2013).
Best regards,
Lamiel
galaxy-wallpaper-27.jpg (1.11 MB) galaxy-wallpaper-27.jpg | the test file to upload | ||
stacktrace-qt.png (185 KB) stacktrace-qt.png | stack trace |
RE: WFileUpload, WProgressBar and --max-memory-request-size 5000000 - Added by Wim Dumon over 7 years ago
Hey Lamiel,
That stack trace is completely bogus, especially in the context of the example you provided. Is there something wrong with your compilation environment? Do stack traces work if your program is behaving normally?
Apart from that, I also recommend that you upgrade to the latest version of Wt, although I doubt that will solve this issue.
Best regards,
Wim.