Bug #6133
closedWFileUpload broken in Wt 4.0.x
0%
Description
Hi,
I'm struggling to find out why the WFileUpload widget is not working any more as it did when using Wt 3.x.
After choosing a file, the changed()
handler is invoked, but after calling upload()
nothing happens, the uploaded()
handler is never called.
Bellow is an extras with the relevant code. Do I miss something?
Thank you in advance,
Cristi
upload_ = addWidget(std::make_unique<WFileUpload>());
upload_->setFileTextSize(20);
auto progress = std::make_unique<WProgressBar>();
progress->setVerticalAlignment(AlignmentFlag::Middle);
upload_->setProgressBar(std::move(progress));
// Upload automatically when the user entered a file
upload_->changed().connect([=]() {
upload_->upload();
});
// React to a successful upload
upload_->uploaded().connect([=]() {
if (upload_->empty()) {
uploadFailed_ = true;
// log error
} else {
uploadFailed_ = false;
uploadedFileName_ = upload_->spoolFileName();
// log success
}
// Signal that a new asynchronous file upload was processed
uploadDone_.emit();
});
Updated by Cristian Ciocaltea about 7 years ago
Would it be possible to increase the priority for this issue? I forgot to do it before submitting and the fields are not editable any more. Thanks!
Updated by Roel Standaert about 7 years ago
I'm not sure why this is not working for you, since it is working in the widget gallery.
Updated by Cristian Ciocaltea about 7 years ago
Which Wt version are you testing against?
I've tried with both 4.0.0 and 4.0.1-rc1, using Chrome/Firefox on Linux Mint 18.2.
Enabling debugging in wt_config.xml doesn't help either, there is no relevant message in the log.
Additionally, there are no JavaScript related messages in the browser console.
Is there anything else I could check?
Updated by Cristian Ciocaltea about 7 years ago
Ok, I did some more investigations and I found an indication of the problem:
WFileUpload: Resource handleRequest(): no signal
I added some more debugging info in handleRequest
method of WFileUploadResource
class and it seems the triggerUpdate
flag is never set because the following evaluates to false
:
if (!files.empty() || request.getParameter("data"))
So, for some reason, the request object doesn't contain the required data. Any ideas why?
Updated by Roel Standaert about 7 years ago
- Status changed from New to Feedback
I'm not sure what's going wrong on your side, I tested a small sample application too (with the latest master and 4.0.1 RC1) and it is working for me.
You are sure that the file you are uploading does not exceed the limit?
Could you maybe create a HAR file? See Issue Tracker Guidelines.
Updated by Cristian Ciocaltea about 7 years ago
The limit was not exceeded, I tested with various files (some of them being only a few bytes in size).
To make sure it's not browser related, I've also tested with Firefox/Chrome/IE on Windows and I got the same behaviour. So it is definitely something wrong on the server side.
The wt library and the application are cross-built with gcc-4.9.2 for 32-bit architecture, but the same environment was perfectly functional with wt-3.3.4.
Could you please tell me what was the environment you have been testing on? Maybe there is a bug or something in the compiler related to the C++11 features used by wt4.
I'm going to create a simple application and test it against a newer compiler (5.4.0).
Updated by Roel Standaert about 7 years ago
Our main testing and development systems (and webtoolkit.eu
) run Ubuntu 16.04, with GCC 5.4.0.
Updated by Cristian Ciocaltea about 7 years ago
The problem is indeed related to the compiler version: I built Wt examples with GCC 4.9.2 and tested with the composer
example - same issue exposed. Then I built Wt with GCC 5.4.0 and the composer example works fine.
It seems I'm now forced to upgrade my toolchain to a newer version - I'm going to give GCC 6.x a try and come back to you with the results.
Updated by Cristian Ciocaltea about 7 years ago
I updated my cross compiler to GCC 6.3.0 and rebuilt the application without doing any other changes at the source code level. The file upload is working fine now.
The conclusion is that WFileUpload might be broken in Wt 4.0.x when using a GCC compiler older than 5.x. At least this is the case for GCC 4.9.2.
Updated by Roel Standaert about 7 years ago
- Status changed from Feedback to Closed
As this appears to be an issue with older versions of GCC, but not with GCC 5 or higher, I'm going to close this.