你把enctype = multipart/form-data删掉应该就可以了,multipart/form-data 是新增的编码类型,以提高二进制文件的传输效率。一帮情况下做法是用Servlet程序来做的,例如:
<form enctype="multipart/form-data" action="http://server/UploadFile" method=post>
其中http://server/UploadFile是一个Servlet程序。
<form enctype="multipart/form-data" action="http://server/UploadFile" method=post>
其中http://server/UploadFile是一个Servlet程序。
你好!
我现在想在本页输入信息后,马上就可以在本页取得,有什么好的方法吗?
我上传是用javabean实现的,我觉得用你说的方法去完成的话,和我用的没有什么不同啊!
我就是想取的有关文件的信息,就如同在我上面的程序中文本输入框中的信息。
请问还有什么好的建议没有??
可惜我问了好多的问题就是没有人答对!
不过仍然感谢大家的关心!
我现在就是想取得uppage.jsp中的参数fileInputArea和commentArea
我试了好多次都得不到,都是null,我的目的就是要取得这些参数,
请提供一些建议!
谢谢!!!!
out.print("Comment="+request.getParameter("commentArea"));
fileInfo=null
comment=null
如果就是这么简单的话我也就不问了!
现在我取得commentArea的方法:
String comments = myUpload.getRequest().getParameter("commentArea");
out.print(comments);
现在是可以了comment可以输出了,
但是我用同样的方法输出的fileInputArea却依然是null。
请问大家还有什么好 建议吗?
谢谢
建议你参考一下jspsmartupload的例子,因为我不知道你的javabean的代码是什么,所以具体的我也说不出来,下面给出一个相似的例子,但愿对你有帮助。
html的界面:sample2.htm
<HTML>
<BODY BGCOLOR="white"><H1>jspSmartUpload : Sample 2</H1>
<HR><FORM METHOD="POST" ACTION="/jspsmartupload/jsp/sample2.jsp" ENCTYPE="multipart/form-data">
<INPUT TYPE="FILE" NAME="FILE1" SIZE="50"><BR>
<INPUT TYPE="FILE" NAME="FILE2" SIZE="50"><BR>
<INPUT TYPE="FILE" NAME="FILE3" SIZE="50"><BR>
<INPUT TYPE="FILE" NAME="FILE4" SIZE="50"><BR>
<INPUT TYPE="SUBMIT" VALUE="Upload">
</FORM></BODY>
</HTML>
sample2.jsp<%@ page language="java" import="com.jspsmart.upload.*"%>
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" /><HTML>
<BODY BGCOLOR="white"><H1>jspSmartUpload : Sample 2</H1>
<HR><%
// Variables
int count=0; // Initialization
mySmartUpload.initialize(pageContext); // Upload
mySmartUpload.upload(); // Select each file
for (int i=0;i<mySmartUpload.getFiles().getCount();i++){ // Retreive the current file
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(i); // Save it only if this file exists
if (!myFile.isMissing()) { // Save the files with its original names in a virtual path of the web server
myFile.saveAs("/upload/" + myFile.getFileName());
// myFile.saveAs("/upload/" + myFile.getFileName(), mySmartUpload.SAVE_VIRTUAL); // sample with a physical path
// myFile.saveAs("c:\\temp\\" + myFile.getFileName(), mySmartUpload.SAVE_PHYSICAL); // Display the properties of the current file
out.println("FieldName = " + myFile.getFieldName() + "<BR>");
out.println("Size = " + myFile.getSize() + "<BR>");
out.println("FileName = " + myFile.getFileName() + "<BR>");
out.println("FileExt = " + myFile.getFileExt() + "<BR>");
out.println("FilePathName = " + myFile.getFilePathName() + "<BR>");
out.println("ContentType = " + myFile.getContentType() + "<BR>");
out.println("ContentDisp = " + myFile.getContentDisp() + "<BR>");
out.println("TypeMIME = " + myFile.getTypeMIME() + "<BR>");
out.println("SubTypeMIME = " + myFile.getSubTypeMIME() + "<BR>"); count ++; } } // Display the number of files which could be uploaded
out.println("<BR>" + mySmartUpload.getFiles().getCount() + " files could be uploaded.<BR>"); // Display the number of files uploaded
out.println(count + " file(s) uploaded.");
%>
</BODY>
</HTML>