NutzCN Logo
问答 org.nutz.mvc.upload.UploadUnsupportedFileNameException: Unsupport file name
发布于 3227天前 作者 kmlixh 3136 次浏览 复制 上一个帖子 下一个帖子
标签:

错误代码如下,为何提示Unsupport file name??

10:40:24,343 WARN FailProcessor:28 - Error@/api/uploadpsd :
org.nutz.mvc.upload.UploadUnsupportedFileNameException: Unsupport file name '95cdfeef.jpg'
at org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:140)
at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:183)
at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:1)
at org.nutz.mvc.adaptor.AbstractAdaptor.adapt(AbstractAdaptor.java:216)
at org.nutz.mvc.upload.UploadAdaptor.adapt(UploadAdaptor.java:118)
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:113)
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:67)
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:183)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2522)
at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2511)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)

4 回复

你的上传配置里没有设置可发的文件后缀

贴下我的配置给你

var uploadIoc = {
	tmpFilePool : {
		type : 'org.nutz.filepool.NutFilePool', // 临时文件最大个数为 1000 个
		args : [ {
			java : "$conf.get('upload.temp','~/tmp')"
		}, 1000 ]
	},
	uploadFileContext : {
		type : 'org.nutz.mvc.upload.UploadingContext',
		singleton : true,
		args : [ {
			refer : 'tmpFilePool'
		} ],
		fields : {
			// 是否忽略空文件, 默认为 false
			ignoreNull : true,
			// 单个文件最大尺寸(大约的值,单位为字节,即 1048576 为 1M)
			maxFileSize : {
				java : "$conf.getInt('upload.maxFileSize',5048576)"
			},
			nameFilter : {
				java : "$conf.get('upload.nameFilter','^(.+[.])(doc|docx|ppt|pptx|pdf|jpg|gif)$')"
			}
		}
	},
	upload : {
		type : 'org.nutz.mvc.upload.UploadAdaptor',
		singleton : true,
		args : [ {
			refer : 'uploadFileContext'
		} ]
	}
};

叨扰各位,十分抱歉。问题找到了,我做了nameFilter : '^(.+[.])(psd|PSD)$',以前只能上传psd文件,现在可以上传图片。忘记修改这里的限制。

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