读书人

jspSmartUpload有关问题

发布时间: 2011-12-21 23:56:01 作者: rapoo

jspSmartUpload问题
昨天都好好的
今天一来就用不起了

Form 是这样写的

HTML code
<form action="<c:url value='/pub/uploadTeSearch.htm'/>"  enctype='multipart/form-data" method="POST">

...
<td align="center" colspan="2">上传: <input type="file" /></td>
...
Java code
request.setCharacterEncoding("UTF-8");            response.setContentType("text/html; charset=UTF-8");            SmartUpload mySmartUpload = new SmartUpload();                        //上传初始化            mySmartUpload.initialize(this.getServletConfig(), request, response);            //上传            mySmartUpload.upload();            logger.debug("正在上传...");            mySmartUpload.getFiles().getSize();            File myfile = mySmartUpload.getFiles().getFile(0);            if( myfile != null ){                String sufix = myfile.getFileExt().toLowerCase();                if(ServiceUtil.isNotNull(sufix)){                    if(!sufix.endsWith("doc")){                        throw new MessageRuntimeException("只能上传后缀名为 doc的文档!!!");                    }                }            }                



File myfile = mySmartUpload.getFiles().getFile(0);
这句就报错了

Files' name is invalid or does not exist (1205).

[解决办法]
不好意思我没有用这个。这个很少人用啦,具说不在更新啦!现在大多用apache的
[解决办法]
http://www.knowsky.com/3136.html
http://www.blogjava.net/hijackwust/archive/2007/08/22/138598.html



看看这两个连接对你有用没
[解决办法]
Java code
    SmartUpload su=new SmartUpload();              su.initialize(pageContext);                        su.upload();              com.jspsmart.upload.File file = su.getFiles().getFile(0);               if(file.isMissing()==false)//判断是否存在       {file.saveAs("" ,su.SAVE_VIRTUAL);} 

读书人网 >J2EE开发

热点推荐