Project

General

Profile

Strange behavior for WFileUpload

Added by Hans-Michael Muller over 8 years ago

Hello,

the example you provide for WFileUpload causes the error message

[2016-Oct-12 13:14:27.673954] 29823 - [info] "wtfcgi: caught SIGCHLD: pid=17019, stat=0"

[2016-Oct-12 13:14:27.674027] 29823 - [info] "wtfcgi: deleting session: eD8XLdkFzivGaeQ7"

[2016-Oct-12 13:14:27.676493] 17147 [/cgi-bin/tc/tpc rcLxgqrvQEaZquPV] [info] "WebRequest: took 2.339ms"

[2016-Oct-12 13:14:27.680754] 17147 [/cgi-bin/tc/tpc rcLxgqrvQEaZquPV] [info] "WebRequest: took 0.298ms"

[Wed Oct 12 13:14:27.746877 2016] [fastcgi:error] [pid 29824:tid 140164269516544] [client 127.0.0.1:57547] FastCGI: incomplete headers (2 bytes) received from server "/usr/lib/cgi-bin/tc/tpc", referer: http://localhost/cgi-bin/tc/tpc

and the progress bar does not work. The file is uploaded, though. Any ideas why that is? Code is as follows.

Thanks for your help,

Michael.

////////

#include

#include

#include

#include

#include

#include

#include

#include

#include

#include

Wt::WApplication * createApplication(const Wt::WEnvironment & env) {

Wt::WApplication * app = new Wt::WApplication(env);

app->setTheme(new Wt::WBootstrapTheme);

Wt::WContainerWidget * container = new Wt::WContainerWidget();

Wt::WFileUpload * fu = new Wt::WFileUpload(container);

fu->setFileTextSize(50); // Set the maximum file size to 50 kB.

fu->setProgressBar(new Wt::WProgressBar());

fu->setMargin(10, Wt::Right);

// Provide a button to start uploading.

Wt::WPushButton *uploadButton = new Wt::WPushButton("Send", container);

uploadButton->setMargin(10, Wt::Left | Wt::Right);

Wt::WText *out = new Wt::WText(container);

// Upload when the button is clicked.

uploadButton->clicked().connect(std::bind([ = ] (){

fu->upload();

uploadButton->disable();

}));

// Upload automatically when the user entered a file.

fu->changed().connect(std::bind([ = ] (){

fu->upload();

uploadButton->disable();

out->setText("File upload is changed.");

}));

// React to a succesfull upload.

fu->uploaded().connect(std::bind([ = ] (){

out->setText("File upload is finished.");

}));

// React to a file upload problem.

fu->fileTooLarge().connect(std::bind([ = ] (){

out->setText("File is too large.");

}));

app~~root()~~>addWidget(container);

return app;

}

int main(int argc, char **argv) {

return Wt::WRun(argc, argv, & createApplication);

}


Replies (2)

RE: Strange behavior for WFileUpload - Added by Wim Dumon over 8 years ago

Hey Hans,

If I'm not mistaken, the fcgi frontend does not support the progress bar. It is technically not feasible.

Your application seems to exit; it is not clear to me why this happens. Do you get extra insight when you attach a debugger to the client process?

Best regards,

Wim.

RE: Strange behavior for WFileUpload - Added by Hans-Michael Muller over 8 years ago

Hi Wim,

thanks for your reply. Can you point me to a tutorial/webpage how to attach a debugger to a client process? (I am concerned that there is anything special to it.)

Michael.

    (1-2/2)