问答详情
源自:3-1 使用SmartUpload实现文件批量上传

使用SmartUpload上传文件不成功

使用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");


提问者:乡下人2 2015-10-27 11:55

个回答

  • kekeli
    2016-08-18 10:12:33

    同问!!!

  • 星战情缘
    2016-06-01 18:34:38

    我也是,怎么解决啊!

  • luckyforever
    2016-03-19 23:28:47

    使用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");