使用jspsmartUpload组件之一
2007-12-14 00:38
357 查看
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>uploadFiles</title>
</head>
<body>
<form method="post" action="do_upload.jsp" name="form1" ENCTYPE="multipart/form-data"><p> </p>
<table width="75%" border="1" align="center">
<tbody><tr align="center">
<td> 1.<input type="file" name="file1" size="30"></td></tr>
<tr>
<td align="center"> 2.<input type="file" name="file2" size="30"></td></tr>
<tr>
<td align="center"> 3.<input type="file" name="file3" size="30"></td></tr>
<tr>
<td align="center"> 4.<input type="file" name="file4" size="30"></td></tr>
<tr>
<td align="center"> <input type="submit" value="上传"></td></tr>
</tbody></table>
</form>
</body>
</html>
处理页面:
<%@ page language="java" contentType="text/html; charset=gb2312"%>
<%@ page import="com.jspsmart.upload.*,java.util.*" %>
<html>
<head>
<title>文件提交处理页面</title>
<%!
public String codeToString(String str)
...{
String s=str;
try
...{
byte[]temp=str.getBytes("ISO-8859-1");
s=new String(temp);
return s;
}
catch(Exception e)
...{
return s;
}
}
%>
</head>
<body>
<p>
<%
SmartUpload su=new SmartUpload();
su.initialize(pageContext);
//su.setAllowedFilesList("html,htm");
su.setDeniedFilesList("html,htm");
//这里可以设置一些上传的参数
su.upload();
int count=su.save("upload");
out.println(count+"个文件上传成功!");
for(int i=0;i<su.getFiles().getCount();i++)
...{
com.jspsmart.upload.File file=su.getFiles().getFile(i);
if(file.isMissing()) continue;
out.println("<table border=1>");
out.println("<tr><td>表单项名</td><td>"+file.getFieldName()+"</td></tr>");
out.println("<tr><td>文件长度</td><td>"+file.getSize()+"</td></tr>");
out.println("<tr><td>文件名</td><td>"+file.getFieldName()+"</td></tr>");
out.println("<tr><td>文件扩展名</td><td>"+file.getFileExt()+"</td></tr>");
out.println("<tr><td>文件全名</td><td>"+codeToString(file.getFilePathName())+"</td></tr>");
out.println("</table><br>");
}
%>
</p>
</body>
</html>
相关文章推荐
- 使用jspSmartUpload组件进行文件上传、下载、批量下载
- 在jsp中使用smartupload组件上传文件
- 多表单提交 - 再谈JSP使用SmartUpload组件上传的中文问题
- 搞定使用jspsmartupload 组件进行上传和下载出现的乱码问题。
- 使用smartupload组件上传图片(jsp+servlet)
- 在jsp中使用smartupload组件上传文件ggg
- 在jsp中使用smartupload组件上传文件
- JSP中使用jspsmartupload组件进行文件的上传和下载
- jsp使用jspSmartUpLoad组件实现中文文件下载
- 使用smartupload组件实现jsp+jdbc上传下载文件实例解析
- jspSmartUpload 组件的使用方法
- JSP 文件 下载 代码 (不使用 jsp smart upload 组件) 解决中文名 问题
- 在jsp中使用smartupload组件上传文件
- 【转】在jsp中使用smartupload组件上传文件
- jspSmartUpload 组件的使用方法
- 在jsp中使用smartupload组件上传文件
- 在jsp中使用smartupload组件上传文件
- 【转】JspSmartUpload组件的使用说明
- 使用JspSmartUpload组件上传文件
- jspSmartUpload使用详解(JSP上传下载组件)