With the correct servlet mapping (other email) it kind of works, but the file has zero size.

in ServletMultiPartRequest.extractFile(Part part, String saveDir)

it creates an empty temporary file (line 134) which it returns:

File tempFile = File.createTempFile(prefix + "_", suffix, new File(saveDir));

if I add the data from the original file it works (but slow).

try (OutputStream out = new FileOutputStream(tempFile)) {
            InputStream fileContent = part.getInputStream();

            int read = 0;
            final byte[] bytes = new byte[1024];

            while ((read = fileContent.read(bytes)) != -1) {
                out.write(bytes, 0, read);
            }
        }

Is it possible to use the original temp file that tomcat creates rather than creating another one?

On 30/12/2022 08:18, Lukasz Lenart wrote:
czw., 29 gru 2022 o 17:40 Greg Huber <gregh3...@gmail.com> napisał(a):
Does not seem to call the servlet, only a 404.  I use the 
StrutsPrepareAndExecuteFilter.  With the filter mapping, how does it use the 
servlet mapping?
The basic idea is that when the filter detects if this a fileupload
request and the new ServletMultiPartRequest is used, it will skip
processing and let the servlet do the job.

boolean isMultipartRequest = request instanceof MultiPartRequestWrapper
is still false.
Strange, this happens here [1] after the request was recognised as multipart [2]

[1] 
https://github.com/apache/struts/blob/master/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java#L919-L930
[2] 
https://struts.apache.org/core-developers/file-upload.html#disabling-file-upload-support


Regards

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org
For additional commands, e-mail: dev-h...@struts.apache.org

Reply via email to