图片上传出现了问题
<form action= "1.jsp " method= "post " name= "infor " ENCTYPE= "multipart/form-data ">
<table width= "550 " border= "0 " align= "center " cellpadding= "4 " cellspacing= "1 ">
<tbody>
<tr bgcolor= "#ffffff ">
<td width= "25% " align= "left "> 产品名称 </td>
<td width= "75% " align= "left "> <input name= "product_name " />
<font color= "red "> * </font>
</tr>
<tr bgcolor= "#ffffff ">
<td width= "25% " align= "left " > 上传图片 </td>
<td width= "75% " align= "left " > <input type= "file " size= "20 " name= "imagefile " /> 文件类型为 jpg,bmp,gif 小于1M </td>
</tr>
</tbody>
</table>
<input type= "submit " name= "Submit " value= "提交 ">
<input type= "reset " value= "重置 ">
</form>
点击提交按钮的时候,我想在1.jsp页面得到 "product_name "的值为什么得不到啊.只有将 " ENCTYPE= "multipart/form-data " "去掉就行了,但是去掉了可又不能上传图片了.这到底如何是好呀.
------解决方案--------------------你把得到的流写出来或写到文件里,就可以找到你的 product_name了
------解决方案--------------------用newxy的文件上传技术,很简单,不用写java代码:
在线演示:http://www.newxy.net/zh_cn/samples/sample2/demo.jsp
jsp页面:
文件上传到文件夹
<%@ page contentType= "text/html; charset=GBK " %>
<%@ taglib uri= "/WEB-INF/newxy-html.tld " prefix= "nhtml "%>
<%@ taglib uri= "/WEB-INF/newxy-logic.tld " prefix= "nlogic "%>
<nlogic:action1 id= "act1 " formName= "fileForm "/>
<nhtml:form action= " " formName= "fileForm " enctype= "multipart/form-data ">
文件夹: <input type= "text " name= "_directory " size= "40 "/> <br />
文件1,不大于1024K: <nhtml:file property= "file1 "