Project

General

Profile

Actions

Bug #8544

open

WFileUpload : uploaded signal never called

Added by jean sorrant almost 4 years ago. Updated about 1 month ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
05/19/2021
Due date:
% Done:

0%

Estimated time:

Description

Hello,

I had to replace line WFileUpload.C:49
Utils::find(request.uploadedFiles(), "data", files);
by
Utils::find(request.uploadedFiles(), "\"data\"", files);

to make it works

version tag 4.5.0


Files

main.cpp (1.45 KB) main.cpp a simple exemple jean sorrant, 05/19/2021 03:40 PM
main.cpp (1.45 KB) main.cpp jean sorrant, 05/20/2021 09:39 AM
Actions #1

Updated by jean sorrant almost 4 years ago

Hello,

I had to replace line WFileUpload.C:49
Utils::find(request.uploadedFiles(), "data", files);
by
Utils::find(request.uploadedFiles(), "\"data\"", files);

to make it works

version tag 4.5.0

build myself

debian 8
gcc (Debian 4.9.2-10+deb8u2) 4.9.2
cmake -DBUILD_EXAMPLES=OFF -DENABLE_HARU=ON -DENABLE_LIBWTDBO=OFF -DSHARED_LIBS=OFF -DCMAKE_BUILD_TYPE=Debug -DDEBUG=ON ..

Actions #2

Updated by Korneel Dumon almost 4 years ago

Hi Jean,
I actually can't reproduce this and I'm not sure what would cause the difference. Your system seems quite old, perhaps that has something to do with it. Other than that I don't really know.

Apart from that, your code mentions fu->setFileTextSize(50); // Set the maximum file size to 50 kB.. This method just determines the size of the input-field. To configure max upload size, check out <max-request-size> in wt_config.xml. The default is 128kB, so I don't think that's what is causing your problem.

Actions #3

Updated by Rolf Anderegg about 1 month ago

Hi,

I experienced the same thing on 4.6.3.

When I apply the following:

diff --git a/src/Wt/WFileUpload.C b/src/Wt/WFileUpload.C
index 6b7f10bfdab1..b3ea4e3169f6 100644
--- a/src/Wt/WFileUpload.C
+++ b/src/Wt/WFileUpload.C
@@ -50,7 +50,14 @@ protected:
 #ifdef WT_TARGET_JAVA
     static Http::UploadedFile* uploaded;
 #endif
-    Utils::find(request.uploadedFiles(), "data", files);
+    Utils::find(request.uploadedFiles(), "\"data\"", files);
+#ifdef WT_DEBUG_ENABLED
+    LOG_DEBUG("WFileUploadResource::handleRequest: req.uploadedFiles:"<<request.uploadedFiles().size()<<" req.paramMap:"<<request.getParameterMap().size()<<" files:"<<files.size());
+    int idx(0);
+    for (auto& uf: request.uploadedFiles()) {
+        LOG_DEBUG("WFileUploadResource::handleRequest: uf["<<idx++<<"]: key='"<<uf.first<<"' sf='"<<uf.second.spoolFileName()<<"' ct='"<<uf.second.contentType()<<"' cn='"<<uf.second.clientFileName()<<"'");
+    }
+#endif

     if (!request.tooLarge())
       if (!files.empty() || request.getParameter("data"))

then the uploaded signal is emitted and my log reads:

------geckoformboundary411661febd07d24d9a65a7bbdadaf95
Content-Disposition: form-data; name=""data""; filename=""dummy.xml""
Content-Type: text/xml
...
[2025-Apr-03 11:49:33.497] 1598 - [debug] "CgiParser: name: ""data"" ct: text/xml fn: ""dummy.xml"""
[2025-Apr-03 11:49:33.498] 1598 - [debug] "CgiParser: spooling file to /tmp/wt3Dwe1L"
[2025-Apr-03 11:49:33.498] 1598 - [debug] "CgiParser: completed spooling"
[2025-Apr-03 11:49:33.498] 1598 [/ axfaIAgacIapkRpt] [debug] "WFileUpload: WFileUploadResource::handleRequest: req.uploadedFiles:1 req.paramMap:4 files:1"
[2025-Apr-03 11:49:33.499] 1598 [/ axfaIAgacIapkRpt] [debug] "WFileUpload: WFileUploadResource::handleRequest: uf[0]: key='""data""' sf='/tmp/wt3Dwe1L' ct='text/xml' cn='""dummy.xml""'"
[2025-Apr-03 11:49:33.499] 1598 [/ axfaIAgacIapkRpt] [debug] "WFileUpload: Resource handleRequest(): signaling uploaded"

So for some reason the name value ( "data" ) in the form-data is double double-quoted.

Actions

Also available in: Atom PDF