NutzCN Logo
问答 上传图片没问题,excel上传失败
发布于 3131天前 作者 汉歌 3131 次浏览 复制 上一个帖子 下一个帖子
标签:
Starting scanner at interval of 10 seconds.
2016-04-27 12:01:44,441 [DEBUG][org.nutz.mvc.impl.UrlMappingImpl] - Found mapping for [POST] path=/admin/file/upload : FileAct.upload(FileAct.java:66)
2016-04-27 12:01:44,456 [DEBUG][org.nutz.mvc.upload.UploadAdaptor] - Select Html4 Form upload parser --> /rk_cms/admin/file/upload.rk
2016-04-27 12:01:44,456 [DEBUG][org.nutz.mvc.upload.FastUploading] - FastUpload : /admin/file/upload
2016-04-27 12:01:44,456 [DEBUG][org.nutz.mvc.upload.FastUploading] - info created
2016-04-27 12:01:44,456 [DEBUG][org.nutz.mvc.upload.FastUploading] - Params map created - 1 params
2016-04-27 12:01:44,456 [DEBUG][org.nutz.mvc.upload.FastUploading] - boundary: 
-----------------------------7e032ca1306
2016-04-27 12:01:44,472 [DEBUG][org.nutz.mvc.upload.FastUploading] - skip first boundary
2016-04-27 12:01:44,472 [DEBUG][org.nutz.mvc.upload.FastUploading] - Reading...
2016-04-27 12:01:44,472 [DEBUG][org.nutz.mvc.upload.FastUploading] - Upload File info: FilePath=[bj-bjmr110_20160323.csv],fieldName=[file]
2016-04-27 12:01:44,472 [DEBUG][org.nutz.mvc.upload.FastUploading] - Upload Info: name=bj-bjmr110_20160323.csv,content_type=application/vnd.ms-excel
2016-04-27 12:01:44,472 [INFO][org.nutz.mvc.adaptor.AbstractAdaptor] - Adapter Error catched , but I found AdaptorErrorContext param, so, set it to args, and continue
org.nutz.mvc.upload.UploadUnsupportedFileNameException: Unsupport file name 'bj-bjmr110_20160323.csv' 
	at org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:140)
	at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:189)
	at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:65)
	at org.nutz.mvc.adaptor.AbstractAdaptor.adapt(AbstractAdaptor.java:226)
	at org.nutz.mvc.upload.UploadAdaptor.adapt(UploadAdaptor.java:120)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:28)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.integration.shiro.NutShiroProcessor.process(NutShiroProcessor.java:51)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:196)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212)
	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399)
	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450)
	at org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
	at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
	at org.mortbay.jetty.Server.handle(Server.java:326)
	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

3 回复

upload.js之类的地方限制了后缀

兽总,如何把 文件类型限制的后缀 的代码错误,改成 返回 错误提示信息

效果如下

如 throw new UploadUnsupportedFileNameException(meta);
改成了	
	NutMap status  = new NutMap();

log.warn (String.format("Unsupport file name '%s' ", meta.getFileLocalPath()));
			status.addv( "status", String.format("Unsupport file name '%s' ", meta.getFileLocalPath()));
			return status;

添加回复
请先登陆
回到顶部