废话不多说,直接奔主题
大家都知道,当form表单中既要提交文本,又要上传图片时,必需在form表单中加上属性enctype ="multipart/form-data",但一加上这个属性,用request.getParameter("name的值")是无法获取的,怎办呢?
只能用fileupload的提供的方法了,我的例子如下:
我的form表单:
<formaction="<%=request.getContextPath()%>/servlet/addproductServlet"method="post" enctype = "multipart/form-data">
获取其中的值并上传文件如下:
String productName=null,productDes=null,sort=null,fileupS=null,fileupB=null;
重要细节:<input "file"name="xxx"/>中一定要有name属性,否则取不到file数据!!!!!!!!

被折叠的 条评论
为什么被折叠?



