I just started practicing struts, so I\'m kinda new to this framework. So, what I\'m trying to do is upload an image using this JSP file :
Change your input name to begin with a lowercase character:
Then in Action you need to prepend the File variable's name to the contentType and FileName Strings, as follows:
private File image;
private String imageContentType;
private String imageFileName;
/* GETTERS AND SETTERS FOR ALL OF THEM */
You may also being interested in how to configure the maximum size for a single file (and for the entire request), allow only certain kind of files to be uploaded, or upload multiple files at once.
EDIT
You didn't post your struts.xml and web.xml configuration, but the line of the stacktrace
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
unveils that you are using the wrong Filter.
Also the File Upload Interceptor seems to be configured to run twice... and this usually happens when configuring it the wrong way, like
2097152
image/png,image/gif,image/jpeg,image/pjpeg
instead of
2097152
image/png,image/gif,image/jpeg,image/pjpeg
Again, check carefully your configuration both in web.xml and struts.xml, it will work automatically.