WFileUpload not removing temporary file when widget deleted?
Added by Steve Drake about 11 years ago
I have a web app built on Wt version 3.2.1. It uses the built-in Wt web server and is deployed on a Linux embedded system. I am using WFileUpload to allow the user to upload a file to the server. If the user cancels the upload part way through the file transfer, there is a temporary file left behind (such as /tmp/wt8J3ae0).
The Wt documentation says: "The uploaded file is automatically spooled to a local temporary file which will be deleted together with the WFileUpload widget, unless stealSpooledFile() is called." (I am not calling stealSpooledFile.)
I have verified that the WFileUpload destructor is being called (by temporarily creating a derived class and putting a printf in the destructor).
Have I found a bug, or am I doing something wrong?
As a workaround, I tried connecting an event handler to the user clicking my Cancel button, and making the event handler delete the file by name. The handler gets called, but when I try to get the name of the file to delete by calling spoolFileName(), it returns an empty string. So that approach is not viable.
I guess I could delete all /tmp/wt* files but that approach has some drawbacks.
Any suggestions?
Thanks,
Steve
Replies (1)
RE: WFileUpload not removing temporary file when widget deleted? - Added by Koen Deforche about 11 years ago
Hey Steve,
This problem might have been fixed since; at least I could not reproduce with latest git (and thus 3.3.1rc1).
Regards,
koen