上传时,怎么将多个图片同时进行上传,因为我获取的时候这样
:SmartUpload mySmartUpload = new SmartUpload();
try {
mySmartUpload.initialize(getServletConfig(), request, response);
mySmartUpload.setMaxFileSize(5120000);
mySmartUpload.setAllowedFilesList("jpg,JPG");
mySmartUpload.upload();
} catch (Exception e) {
response.sendRedirect("/Wendy2/error.jsp");
return;
}
com.jspsmart.upload.File file = mySmartUpload.getFiles().getFile(0);
String filename = "";
try {
String name = file.getFileName();
int pos = name.indexOf(".");
String type = name.substring(pos, name.length());
long time = new Date().getTime();
filename = "zhongcheng" + time + type;
file.saveAs("/upload/" + filename);
} catch (Exception e1) {
response.sendRedirect("../error.jsp");
return;
}
我要将filename存到数据库中,是这样的吧,但是我现在想同时多存几个图片,不知道要怎么修改,请大家指导下
:SmartUpload mySmartUpload = new SmartUpload();
try {
mySmartUpload.initialize(getServletConfig(), request, response);
mySmartUpload.setMaxFileSize(5120000);
mySmartUpload.setAllowedFilesList("jpg,JPG");
mySmartUpload.upload();
} catch (Exception e) {
response.sendRedirect("/Wendy2/error.jsp");
return;
}
com.jspsmart.upload.File file = mySmartUpload.getFiles().getFile(0);
String filename = "";
try {
String name = file.getFileName();
int pos = name.indexOf(".");
String type = name.substring(pos, name.length());
long time = new Date().getTime();
filename = "zhongcheng" + time + type;
file.saveAs("/upload/" + filename);
} catch (Exception e1) {
response.sendRedirect("../error.jsp");
return;
}
我要将filename存到数据库中,是这样的吧,但是我现在想同时多存几个图片,不知道要怎么修改,请大家指导下
解决方案 »
- 动态调用方法
- 谁会oauth
- 【求助】JAVA新手,几个小问题请高人帮助解惑。谢谢!
- 如何制作日志~~~~~~~~~~~~~~~~
- myfaces+facelets兼容性
- 非常easy进来就给分
- 关于中文问题:http://localhost:8080/aa/jsp2.jsp?user=%u516C%u53F8&pass=公司
- JSP程序如何打包
- vj++中的JAR或CLASS在那里找,即COM.MS.....(分必给)!!!如何设为环境变量!!
- hibernate 用一个表的不是主键的普通字段映射成另一个表的外键
- Servlet里如何实现会话跟踪与判断
- 导航栏参数传递的问题 希望得到大家帮助
http://topic.csdn.net/u/20080506/08/0c15e42d-3452-4e7e-8198-ecd44122c9e8.html?seed=2056147381