servlet 中使用smartupload 组件
来源:互联网 发布:常德网络推广公司 编辑:程序博客网 时间:2024/06/04 19:07
response.setContentType("text/html;charset=gb2312");
PrintWriter out = response.getWriter();
SmartUpload mySmartUpload = new SmartUpload();
String currentDirectoryPath=null;
String savePath="E:/public_html/java_root/NETDISK/WebRoot/NET_SPACE/1/我的音乐/";
//mySmartUpload.setDenyPhysicalPath(true);
mySmartUpload.setForcePhysicalPath(true);
mySmartUpload.initialize(this.getServletConfig(), request,response);
// 设定上传限制
// 1.限制每个上传文件的最大长度。10M
mySmartUpload.setMaxFileSize(10000000);
// 2.限制总上传数据的长度。
// mySmartUpload.setTotalMaxFileSize(20000);
// 3.设定允许上传的文件(通过扩展名限制),仅允许doc,txt文件。
// mySmartUpload.setAllowedFilesList("doc,txt");
// 4.设定禁止上传的文件(通过扩展名限制),禁止上传带有exe,bat, jsp,htm,html扩展名的文件和没有扩展名的文件。
// mySmartUpload.setDeniedFilesList("exe,bat,jsp,htm,html,,");
// Deny physical path
try {
mySmartUpload.upload();
} catch (SmartUploadException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
//读取其它数据
com.jspsmart.upload.Request req = mySmartUpload.getRequest();
String title = req.getParameter("dest");
//保存文件
for (int i = 0; i < mySmartUpload.getFiles().getCount(); i++) {
com.jspsmart.upload.File file = mySmartUpload.getFiles().getFile(i);
if (file.isMissing()) continue;
try {
file.saveAs(savePath+file.getFileName());
} catch (SmartUploadException e) {
// TODO Auto-generated catch block
e.printStackTrace();
logger.info("e:"+e);
}
}
out.println("dest:"+title);
out.close();
PrintWriter out = response.getWriter();
SmartUpload mySmartUpload = new SmartUpload();
String currentDirectoryPath=null;
String savePath="E:/public_html/java_root/NETDISK/WebRoot/NET_SPACE/1/我的音乐/";
//mySmartUpload.setDenyPhysicalPath(true);
mySmartUpload.setForcePhysicalPath(true);
mySmartUpload.initialize(this.getServletConfig(), request,response);
// 设定上传限制
// 1.限制每个上传文件的最大长度。10M
mySmartUpload.setMaxFileSize(10000000);
// 2.限制总上传数据的长度。
// mySmartUpload.setTotalMaxFileSize(20000);
// 3.设定允许上传的文件(通过扩展名限制),仅允许doc,txt文件。
// mySmartUpload.setAllowedFilesList("doc,txt");
// 4.设定禁止上传的文件(通过扩展名限制),禁止上传带有exe,bat, jsp,htm,html扩展名的文件和没有扩展名的文件。
// mySmartUpload.setDeniedFilesList("exe,bat,jsp,htm,html,,");
// Deny physical path
try {
mySmartUpload.upload();
} catch (SmartUploadException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
//读取其它数据
com.jspsmart.upload.Request req = mySmartUpload.getRequest();
String title = req.getParameter("dest");
//保存文件
for (int i = 0; i < mySmartUpload.getFiles().getCount(); i++) {
com.jspsmart.upload.File file = mySmartUpload.getFiles().getFile(i);
if (file.isMissing()) continue;
try {
file.saveAs(savePath+file.getFileName());
} catch (SmartUploadException e) {
// TODO Auto-generated catch block
e.printStackTrace();
logger.info("e:"+e);
}
}
out.println("dest:"+title);
out.close();
- servlet 中使用smartupload 组件
- servlet 中使用smartupload 组件
- servlet 中使用 smartupload 组件编程
- 使用smartupload组件上传图片(jsp+servlet)
- 在jsp中使用smartupload组件上传文件
- 在jsp中使用smartupload组件上传文件
- 在jsp中使用smartupload组件上传文件
- 在jsp中使用smartupload组件上传文件
- 在jsp中使用smartupload组件上传文件
- 在jsp中使用smartupload组件上传文件
- 在jsp中使用smartupload组件上传文件
- 【转】在jsp中使用smartupload组件上传文件
- 在jsp中使用smartupload组件上传文件
- 在jsp中使用smartupload组件上传文件ggg
- SmartUpload组件使用过程中出现的问题
- 在jsp中使用smartupload组件上传文件
- 在handler中使用SmartUpload上传组件失败
- SmartUpload在servlet中使用方法
- 如何改变SQL SERVER的身份验证模式
- 日历控件大全
- 海量数据库的 查询优化及分页算法方案
- asp.net中的联动菜单
- PE文件格式概述
- servlet 中使用smartupload 组件
- 国外生活小百科 (来源: 五湖中视)
- EJB3.0开发入门及其一些重要的特性
- 面向 Java 开发人员的 Ajax: Ajax 的 Java 对象序列
- JDBC4中的新特性
- JS代码混淆初步
- 在ASP.NET 2.0中建立站点导航层次
- ARM开发工具综述转
- google搜索原理论文