java - FileUploadBase does not find any multipart parts when uploading small files -
i using spring's commonsmultipartresolver
process file uploads in servlet 3 environment.
if uploaded file large, works fine.
if uploaded file smaller, resolver fails discover parts (with no exception thrown).
i have tracked down apache.commons.fileupload.fileitemiteratorimpl
findnextitem()
method returns false, despite there being multiple valid parts in post. results in no multipartfile
object being available controller method.
when in debugger @ httpservletrequest
see correct number of parts (getparts()
returns correct number of parts).
i use httpservletrequest
, except large files (>1mb), exception thrown maximum file size (which have configured commonsmultipartresolver
evidently not cross on httpservletrequest
).
i looked @ attempting configure servlet 3 maximum file size, don't want add several new classes application set size.
is there way upload smaller files using servlet 3 , commons-fileupload
?
more
i have commons-fileupload
configured maxuploadsizeperfile
=100mb.
the following behavior results:
if uploaded file > 10mb, commons-fileupload
processes , fine.
if uploaded file between ~3.8 mb , 10 mb, both input stream , underlying connection closed before commons-fileupload
has chance parse request leading connection reset message in browser.
for uploaded files between 1 mb , ~3.8 mb, input stream closed, not underlying connection, allowing error page display error.
and finally, if uploaded file less 1 mb, underlying servlet 3 implementation handles parts before commons-fileupload
gets invoked, leaving commons-fileupload
believing there no parts in request.
this behavior results using spring boot (previously unbeknownst me) automatically configures multi-part servlet 3. causes underlying httpservletrequest
process file upload before commons-fileupload
has chance @ it.
the thing find curious @ point, why not fail if uploaded file large enough.
Comments
Post a Comment