setallowedextensions (String) and setallowedtypes (String) two methods are defined in Fileuploadinterceptor to limit file upload types
1, Setallowedextensions (String) to set the allowed file suffix name to upload,
Setallowedtypes (String) sets the type of file that is allowed to be uploaded, with the recommended Setallowedtypes (string).
Because if you use the Setallowedextensions (String) user to modify the file suffix to allow the upload suffix, you can upload it successfully.
2, uploaded files only setallowedextensions (string) and Setallowedtypes (string) are compatible to upload
<interceptor-ref name= "Defaultstack" >
<!--settings file upload suffix name--
<param name= "Fileupload.allowedextensions" >.jpg,.xml</param>
<!--Set File upload Type--
<param name= "Fileupload.allowedtypes" >image/jpg</param>
</interceptor-ref>
Struts2 limit File Upload type