2 baidu 33777481 baidu_33777481 于 2016.03.07 17:49 提问

SmartUpload文件上传报这个错误,求帮忙

代码
public class BlacklistManagerAction1 extends BaseAction {

@Autowired
private IEntityFactory ef;

@SuppressWarnings({ "deprecation", "unchecked" })
public ActionForward uploadExcel(ActionMapping mapping, ActionForm form,
        HttpServletRequest request, HttpServletResponse response){
    HttpSession session=request.getSession();
    UserstbYj user=(UserstbYj)session.getAttribute("user");
    StringBuffer pub_sb=(StringBuffer)session.getAttribute("pub_sb");

// as.initStringBuffer(pub_sb);
// String tableName="AD_BLACKLISTTB";
// String fieldNames=(String)session.getAttribute("fieldNames");
// List fieldTypes=(List)session.getAttribute("fieldTypes");
// List fieldCNNames=(List)session.getAttribute("fieldCNNames");
// Integer count=fieldCNNames==null?0:fieldCNNames.size();
Integer count = 11;

    SmartUpload su = new SmartUpload();
    String msg="";
    try {
        su.initialize(request.getSession().getServletContext(),request.getSession(),request,response,null);
        su.upload();
        for(int i=0;i<su.getFiles().getCount();i++){
            com.jspsmart.upload.File f=su.getFiles().getFile(i);
            String fileName=f.getFileName();
            if(fileName.trim().indexOf(".xls")==-1){
                request.setAttribute("message","对不起,您上传的文件不是excel文件,必须上传.xls类型的文件。");
                request.setAttribute("forward","sys_blacklist.do");
                return mapping.findForward("GlobalMsg");
            }
            su.save("/tempExcel/"+user.getUserid());
            String serverFile= FileUtil.getWebSysPath()+"tempExcel"+"/"+user.getUserid()+"/"+fileName;
            msg=as.excelToDBBlack(serverFile,count,pub_sb);
        }
    } catch (Exception e) {
        e.printStackTrace();
        log.error("上传失败。"+e);
        request.setAttribute("message", "上传失败,请联系管理员。");
        request.setAttribute("forward", "sys_blacklist.do");
        return mapping.findForward("GlobalMsg");
    }

    request.setAttribute("message",msg);
    request.setAttribute("forward", "sys_blacklist.do");
    return mapping.findForward("GlobalMsg");
}       

}

错误
java.lang.IllegalArgumentException:This path dose not exist

1个回答

caozhy
caozhy   Ds   Rxr 2016.03.07 18:08

java.lang.IllegalArgumentException:This path dose not exist
目录不存在,如果你的路径用\\分隔符,记得是双斜杠

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!