尝试在struts2中上传图片时
图像未上传并显示以下消息
无法找到struts.multipart.saveDir
属性设置。默认为javax.servlet.context.tempdir
如何解决这个问题
答案 0 :(得分:10)
您能否展示您正在使用的代码,因为这将始终有所帮助。 你需要指定
struts.multipart.saveDir=
struts.xml文件中的属性作为常量条目,或者您需要指定struts.properties中的文件选择是否属于您自己。
struts.multipart.saveDir - The directory where the uploaded files will be placed. If this property is not set it defaults to javax.servlet.context.tempdir.
您的帖子就是这种情况,因为您没有自己指定位置,因此struts2正在获取文件上传的临时位置。
这是定义细节的链接 File Upload
修改强>
在struts.xml
<struts>
<constant name="struts.multipart.saveDir" value="location of your choice" />
...
</struts>
PS:您的录取率似乎很低/没有定义。为了获得帮助,如果能帮助您解决问题,我们总是建议接受答案