package com.jamesby.file.servlet;
public class UpLoadServlet extends HttpServlet {
private static Log log = LogFactory.getLog(UpLoadServlet.class);
private ServletConfig config;
final public void init(ServletConfig config) throws ServletException {
this.config = config;
}
final public ServletConfig getServletConfig() {
return config;
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws
ServletException, IOException {
try {
SmartUpload su = new SmartUpload();
su.initialize(config, request, response);
su.setMaxFileSize(1024 * 1024 * 4); //4M
su.upload();
String paramValue = su.getRequest().getParameter("paramName");
String path = "d:/upload";
for (int i = 0; i < su.getFiles().getCount(); i++) {
com.jspsmart.upload.File file = su.getFiles().getFile(i);
String fileName = file.getFileName();
if (!file.isMissing()) file.saveAs(path + "/"+fileName,SmartUpload.SAVE_PHYSICAL);
else continue;
}
return null;
} catch (Exception ex) {
}
}
}
分享到:
相关推荐
使用SmartUpload 实现文件上传,
使用jspSmartUpload实现文件上传下载,包含SmartUpload方法注解、上传示例及组件包
这个文件是用upload.html和do_upload.jsp两个文件实现的文件上传功能,有点瑕疵就是,中文乱码还没改正,这个还得好好看看smartupload,反正也就4,5个java文件,还有就是上传的文件因为用的是Eclipse,部署时用的...
jspSmartUpload实现文件上传下载
这是我用SmartUpload组件写的一个文件上传的小例子,解压缩后可直接导入到MyEclipse(Eclipse)中运行。这肯定不是文件上传的最好方案,仅供有兴趣的朋友们学习参考!
smartupload是一个很好的文件上传工具,就是中文文件乱码。我已经解决了中文乱码的问题!一个多文件上传的例子,使用了smartupload。上传后的文件名返回给父页面!
SmartUpload文件上传下载方法包文件SmartUpload文件上传下载方法包文件SmartUpload文件上传下载方法包文件SmartUpload文件上传下载方法包文件SmartUpload文件上传下载方法包文件
smartupload组件实现文件上传功能
通过一个上传文件的Demo来演示如何使用SmartUpload上传文件和普通表单
NULL 博文链接:https://sqh-me1232008.iteye.com/blog/468808
采用smartUpload控件文件上传采用smartUpload控件文件上传采用smartUpload控件文件上传
简单 JSP 文件上传 源代码 smartupload 简单 JSP 文件上传 源代码 smartupload 简单 JSP 文件上传 源代码 smartupload 简单 JSP 文件上传 源代码 smartupload
使用smartupload 进行文件上传简单实例。。
在servlet中用SmartUpload进行上传文件,不用jsp的小脚本,在后台进行处理.可以处理中文文件名,其他提交参数为中文也没有问题.
JspSmartUpload上传文件实例,基于JspSmartUpload组件的文件上传实例,JspSmartUpload 上传类,在JSP中进行文件上传的类,内含文档和使用例子。这个在JSP编程环境下,使用频率还是挺高的,这个例子可帮助你在JSp环境...
使用smartupload完成文件的上传,普通表单域处理,文件下载和文件批量下载
SmartUpload组件是应用JSP进行B/S程序开发过程中经常使用的上传下载组件,它使用简单,方便。
java文件上传(smartUpload),提供使用Demo
自己通过smartupload提供的类包实现的文件上传的源码,分享一下,希望对大家有帮助
1,只需要将文件夹upload拷在...3,有jsp文件上传与下载攻略是讲文件上传与下载的各种类中的函数含义的 4,主要包括完整的 jspsmartupload上传与下载,还有jspsmartupload的完整包,并且包括包中各种上传与下载的解释