为了账号安全,请及时绑定邮箱和手机立即绑定

请教一下JSP图片上传的问题

请教一下JSP图片上传的问题

And_I 2016-12-03 19:54:14
if (!item.isFormField()) //文件字段                         {                             String fileName = item.getName();                             if (fileName != null) {                                                             String uploadPah = request.getSession()                                         .getServletContext()                                         .getRealPath("img/Product");                                                                  code="Product"+(new java.util.Date().getTime()+""+(i++)+"");                                                                  if(code!=null)                                 {                                     File saveFile = new File(uploadPah,                                             code+".jpg");                                     item.write(saveFile);                                     if(m.getImage()==null||m.getImage()==""){                                         m.setImage(code+".jpg");                                                                             }else if(m.getImage2()==null||m.getImage2()==""){                                         m.setImage2(code+".jpg");                                                                         }else{                                         m.setImage3(code+".jpg");                                                                         }                                                                      }                                                          }                         }请问怎么判断,如果我在界面没有选择图片的时候提交表单让code不会生成?
查看完整描述

1 回答

?
And_I

TA贡献7条经验 获得超1个赞

此贴终结!我知道了

查看完整回答
1 反对 回复 2016-12-03
  • 1 回答
  • 0 关注
  • 1269 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信