struts2是不是不能上传一个大小为0k的文件啊?
怎么解决这个问题?
[b]问题补充:[/b]
struts2的拦截器只能限制最大上传大小不能设置最小啊?
maximumSize 这个是最大的
最小的我没找到如何设置
[b]问题补充:[/b]
如果上传的文件大小是0K,到Action中的时候,进行文件拷贝的时候,会抛一个filenotfoundException.
但是我试过其他的系统的上传文件,比如说邮箱,我在附件上传中,上传一个0K的文件,发给另外一个人,另外一个人依然能获取这个文件,大小是0?
我就想知道人家是什么机制?
struts 2不能上传一个空文件?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
7条回答 默认 最新
- laitaogood 2009-06-18 18:05关注
修改struts.multipart.parser常量的值为cos/pell
[quote]When not selecting any file to upload in a file input, Struts does not ignore the 0 byte file
returned by jakarta FileUpload.
This means that a file is injected in the action even if nothing was uploaded.In webwork the check was done in the constructor of com.opensymphony.webwork.dispatcher.multipart.JakartaMultiPartRequest:
else if (item.getSize() == 0) {
log.warn("Item is a file upload of 0 size, ignoring");
}In struts the parsing of the request moved from the constructor to a parse method but the
above check disappeared.Additionally this behaviour is inconsistant with the "pell" implementation that ignores 0
byte files.This message is automatically generated by JIRA.[/quote]
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
- ¥20 有关区间dp的问题求解
- ¥15 多电路系统共用电源的串扰问题
- ¥15 slam rangenet++配置
- ¥15 有没有研究水声通信方面的帮我改俩matlab代码
- ¥15 对于相关问题的求解与代码
- ¥15 ubuntu子系统密码忘记
- ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
- ¥15 保护模式-系统加载-段寄存器
- ¥15 电脑桌面设定一个区域禁止鼠标操作