How do you edit .tmp file removal settings?
-
16-06-2021 - |
Question
Using Struts 2: when will the .tmp file - that gets created after uploading a file - be deleted?
How can you customize when the .tmp file should be deleted? Do you have to create a copy of it?
Please don't be shy to give some code :)
Solution
1. This depends on which version of S2 you're talking about.
- S2.2.1 and prior: the file upload interceptor deleted temp files.
- S2.2.3 and above: the filter dispatchers start the deletion process, changed due to WW-3490.
2. Assuming you're using a recent version, it might be possible to inject a tweaked Dispatcher
, although it's not immediately obvious how–if it is, that's the easiest change at the core level.
The easiest approach from a practical standpoint is to copy files in the action, which is also pretty fast on any reasonable file system.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow