错误代码如下,上传的图片格式配置了,png,jpg,gif,测试上传:gif可以,其他两个都报错
org.nutz.mvc.upload.UploadUnsupportedFileNameException: Unsupport file name 'blob'
at org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:139)
at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:179)
at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:62)
at org.nutz.mvc.adaptor.AbstractAdaptor.adapt(AbstractAdaptor.java:200)
at org.nutz.mvc.upload.UploadAdaptor.adapt(UploadAdaptor.java:117)
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:40)
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:99)
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:40)
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:64)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:175)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:744)
配置文件
var ioc = {
upload : {
type : "org.nutz.mvc.upload.UploadAdaptor",
args : [{refer : "uploadCtx"}],
singleton:false
},
uploadCtx : {
type : "org.nutz.mvc.upload.UploadingContext",
args : [{refer: "filePool"}],
singleton : false,
fields : {
// 是否忽略空文件, 默认为 false
ignoreNull : true,
// 单个文件最大尺寸(大约的值,单位为字节,即 1048576 为 1M)
maxFileSize : 29097152,
// 正则表达式匹配可以支持的文件名
nameFilter : ".+(html|js|css|tpl|gif|jpg|png|jpeg|doc|docx|xls|xlsx|ppt|pptx|wps|pdf|txt|chm|mp3|mp4|3gp|rm|swf|flv|asf|wmv|wma|avi|7z|zip|rar|ios|jar|apk|sn)",
extOption: {
"images":"jpg,gif,png,jpeg",
"document":"doc,docx,xls,xlsx,ppt,pptx,wps,pdf,txt,chm",
"music":"mp3",
"video":"mp4,3gp,rm,swf,flv,asf,wmv,wma,avi",
"archive":"7z,zip,rar,ios,jar,apk,sn"
}
}
},
filePool : {
type : "com.hits.common.file.FilePool",
args : ["/temp/", 2000]
}
};