我的接收端是如下配置:
@AdaptBy(type = UploadAdaptor.class, args = { "${app.root}/WEB-INF/tmp"})
@POST
@At(value = {"/open/monitor"},top = true)
@Ok("json")
public Object monitor(@Param("closeup_pic") TempFile[] files,@Param("..")NutMap data, HttpServletRequest req, AdaptorErrorContext err) {
try {
if (err != null && err.getAdaptorErr() != null) {
return Result.error("文件不合法:" + err.toString());
} else {
return Result.success();
//return upload(type,name,files,data,"image");
}
} catch (Throwable e) {
return Result.error("意外错误:"+e.getMessage());
}
}
车牌扫描后,进入try,err不为空有错误,错误信息如下:
[DEBUG] 2018-07-12 14:22:45,002 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'currUser'<class cn.wizzer.app.web.commons.helper.CurrUser>
[WARN ] 2018-07-12 14:22:45,014 org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:197) - Using form upload ? You forgot this --> enctype='multipart/form-data' ?
[INFO ] 2018-07-12 14:22:45,022 org.nutz.mvc.adaptor.AbstractAdaptor.adapt(AbstractAdaptor.java:261) - Adapter Error catched , but I found AdaptorErrorContext param, so, set it to args, and continue
java.lang.RuntimeException: org.nutz.mvc.upload.UploadException: Unknow Content-Type : application/x-www-form-urlencoded
at org.nutz.lang.Lang.wrapThrow(Lang.java:187)
at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:202)
at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:62)
at org.nutz.mvc.adaptor.AbstractAdaptor.adapt(AbstractAdaptor.java:254)
at org.nutz.mvc.upload.UploadAdaptor.adapt(UploadAdaptor.java:120)
at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:30)
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 cn.wizzer.app.web.commons.processor.XssSqlFilterProcessor.process(XssSqlFilterProcessor.java:35)
不清楚问题出在哪,这样是否没有文件类型限制,请指教