使用SmartUpload上传文件没有报错,但save时返回的值是0,为什么?
SmartUpload su=new SmartUpload();
su.initialize(getServletConfig(), request, response);
su.setMaxFileSize(1024*1024*10);
su.setTotalMaxFileSize(1024*1024*100);
su.setAllowedFilesList("jpg,jpeg,bmp,png,gif");
String saveFilePath=getServletContext().getRealPath("/")+"uploadFile";
try {
su.upload();
File path=new File(saveFilePath);
if(!path.exists()){
path.mkdir();
}
int uploadCount=su.save(saveFilePath);
request.getSession().setAttribute("result", "上传成功"+uploadCount);
response.sendRedirect("collectIdea.jsp");
同问!!!
我也是,怎么解决啊!
使用SmartUpload上传文件没有报错,但save时返回的值是0,为什么?
SmartUpload su=new SmartUpload();
su.initialize(getServletConfig(), request, response);
su.setMaxFileSize(1024*1024*10);
su.setTotalMaxFileSize(1024*1024*100);
su.setAllowedFilesList("jpg,jpeg,bmp,png,gif");
String saveFilePath=getServletContext().getRealPath("/")+"uploadFile";
try {
su.upload();
File path=new File(saveFilePath);
if(!path.exists()){
path.mkdir();
}
int uploadCount=su.save(saveFilePath);
request.getSession().setAttribute("result", "上传成功"+uploadCount);
response.sendRedirect("collectIdea.jsp");