请问哪位大哥哥用过mySmartUpload上传文件的?

littledapan 2001-09-22 01:10:02
我用了mySmartUpload上传文件,现在问题是要在上传文件的同时提交几个参数<FORM METHOD="POST" ACTION="sample2.jsp" ENCTYPE="multipart/form-data">
<input type=text name=account value=<%=request.getParameter("account")%>>
<INPUT TYPE="FILE" NAME="FILE1" SIZE="30"><BR>
<INPUT TYPE="SUBMIT" VALUE="Upload ">
请问我在sample2中怎么可以获取account这个参数的值呢(request.getParameter不行的),多谢赐教哦,定全分相送。
我的qq号码是 51828814,希望成为大家的朋友。
...全文
133 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
wilddragon 2001-09-24
天生我才必有用
回复
alphalion 2001-09-23
其实根本就没有什么大不了的问题,你所需要的数据无非是所上传文件的一些信息,根本就不需要对html代码进行操作,只需要利用smartupload这个javabeans所提供的东东进行操作就一切ok了,你看一下他的帮助文档也就一切解决了,如果实在还是不懂,给我来信:alphalion@sina.com,我会给你一个非常全面的关于这方面的源代码,希望我的担心是多余的。
回复
backlove 2001-09-23
Html文件:

<HTML>
<BODY BGCOLOR="white">

<H1>jspSmartUpload : Sample 5</H1>
<HR>

<form METHOD="POST" ACTION="/jspsmartupload/jsp/sample5.jsp" NAME="PW" ENCTYPE="multipart/form-data">
<table CELLSPACING="0" CELLPADDING="3" BORDER="1" WIDTH="474">

<!-- FILE -->
<tr>
<td><small><font face="Verdana">Select a first file :  </font></small></td>
<td><small><font face="Verdana"><input TYPE="file" name="FILE1"></font></small></td>
</tr>

<tr>
<td><small><font face="Verdana">Select a second file :  </font></small></td>
<td><small><font face="Verdana"><input TYPE="file" name="FILE2"></font></small></td>
</tr>

<!-- TEXT -->
<tr>
<td width="150"><div align="left"><p><small><font face="Verdana">Text :  </font></small></td>
<td width="324"><small><font face="Verdana"><input TYPE="TEXT" name="myText" value=""><br></font></small></td>
</tr>

<!-- TEXTAREA -->
<tr>
<td width="150"><div align="left"><p><small><font face="Verdana">Text Area :  </font></small></td>
<td width="324"><small><font face="Verdana"><textarea name="myTextArea" rows="4" value=""></textarea><br></font></small></td>
</tr>

<!-- PASSWORD -->
<tr>
<td><div align="left"><p><small><font face="Verdana">PassWord :  </font></small></td>
<td><small><font face="Verdana"><input TYPE="PASSWORD" name="myPASSWORD" value=""><br></font></small></td>
</tr>

<!-- HIDDEN -->
<tr>
<td><div align="left"><p><small><font face="Verdana">Hidden :  </font></small></td>
<td><small><font face="Verdana"><input TYPE="hidden" name="myHidden" value="hidden"><br></font></small></td>
</tr>

<!-- CHECKBOX -->
<tr>
<td><div align="left"><p><small><font face="Verdana">CheckBox :  </font></small></td>
<td><small><font face="Verdana"><input TYPE="CHECKBOX" name="myCheckBox" value="Value 1">Value 1<br><input TYPE="CHECKBOX" name="myCheckBox" value="Value 2">Value 2<br><input TYPE="CHECKBOX" name="myCheckBox" value="Value 3">Value 3<br></font></small></td>
</tr>

<!-- RADIO -->
<tr>
<td><div align="left"><p><small><font face="Verdana">Radio :  </font></small></td>
<td><small><font face="Verdana"><input TYPE="radio" name="radio" value="Value 1">Value 1<br><input TYPE="radio" name="radio" value="Value 2">Value 2<br><input TYPE="radio" name="radio" value="Value 3">Value 3<br></font></small></td>
</tr>

<!-- SELECT -->
<tr>
<td><div align="left"><p><small><font face="Verdana">Simple Select :  </font></small></td>
<td><small><font face="Verdana"><SELECT name="mySimpleSelect" ><OPTION value="Value 1">Value 1</OPTION><OPTION value="Value 2">Value 2</OPTION><OPTION value="Value 3">Value 3</OPTION></SELECT><br></font></small></td>
</tr>

<!-- SELECT MULTIPLE -->
<tr>
<td><div align="left"><p><small><font face="Verdana">Multiple Select :  </font></small></td>
<td><small><font face="Verdana"><SELECT multiple name="myMultSelect" ><OPTION value="Value 1">Value 1</OPTION><OPTION value="Value 2">Value 2</OPTION><OPTION value="Value 3">Value 3</OPTION></SELECT><br></font></small></td>
</tr>

<!-- SUBMIT -->
<tr>
<td colspan="2" width="474"><div align="center"><center><p><small><font face="Verdana"><input
TYPE="Submit"> </font></small></td>
</tr>
</table>
</form>

</BODY>
</HTML>


Jsp文件:
<%@ page language="java" import="com.jspsmart.upload.*"%>
<%@ page contentType="text/html;charset=gb2312"%>
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />

<HTML>
<BODY BGCOLOR="white">

<H1>jspSmartUpload : Sample 5</H1>
<HR>

<%

// Initialization
mySmartUpload.initialize(pageContext);

// Upload
mySmartUpload.upload();

//
// Files
//

out.println("<BR><STRONG>Display information about Files</STRONG><BR>");

out.println("Number of files = " + mySmartUpload.getFiles().getCount() + "<BR>");
//out.println("Total size (bytes) = " + mySmartUpload.getFiles().getSize() +"<BR>");

for (int i=0;i<mySmartUpload.getFiles().getCount();i++){

out.print(mySmartUpload.getFiles().getFile(i).getFieldName());
if (!mySmartUpload.getFiles().getFile(i).isMissing())
out.print(" = " + mySmartUpload.getFiles().getFile(i).getFileName() + " (" + mySmartUpload.getFiles().getFile(i).getSize() + ")");
else
out.print(" = vide");
out.println("<BR>");
}


//
// Request
//

out.println("<BR><BR><STRONG>Display information about Requests</STRONG><BR>");


// Retreive Requests' names
java.util.Enumeration e = mySmartUpload.getRequest().getParameterNames();
String[] text=mySmartUpload.getRequest().getParameterValues("myText");
String tmp="";
for (int j=0;j<text.length;j++) {
tmp=tmp+text[j];
out.println(text[j]+"<br>");
}

out.println(tmp+"<br>");
//String abc=new String(tmp.getBytes("utf-8"),"gb2312");
//out.println(abc);
//System.out.println(abc);
// Retreive parameters
/*while (e.hasMoreElements()) {

String key = (String)e.nextElement();
String[] values = mySmartUpload.getRequest().getParameterValues(key);

// Browse the current parameter values
for(int i = 0; i < values.length; i++) {
out.print(key + " = ");
out.print(values[i] + "<BR>");
}
}*/

%>


</BODY>
</HTML>




回复
相关推荐
发帖
Web 开发
创建于2007-09-28

8.0w+

社区成员

Java Web 开发
申请成为版主
帖子事件
创建了帖子
2001-09-22 01:10
社区公告
暂无公告