NutzCN Logo
问答 组件上传图片怎么接收?
发布于 1496天前 作者 joy092 1110 次浏览 复制 上一个帖子 下一个帖子
标签:
    @Filters(@By(type=CrossOriginFilter.class))
    @At("/upload/image")
    @Ok("json")
    public Object upload(@Param("file") File tf, HttpServletRequest req, AdaptorErrorContext err) {
        try {
            if (err != null && err.getAdaptorErr() != null) {

我用element组件上传图片接收不到图片

4 回复

看解析日志

来自炫酷的 NutzCN

[DEBUG] 10:49:57.105 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'apiFileTestController'<class cn.wizzer.app.web.modules.controllers.open.ApiFileTestController>
[DEBUG] 10:49:57.106 org.nutz.mvc.filter.CrossOriginFilter.match(CrossOriginFilter.java:49) - Feedback -- [*] [GET, POST, PUT, DELETE, OPTIONS, PATCH] [Origin, Content-Type, Accept, X-Requested-With] [true]
[DEBUG] 10:49:57.188 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [POST] path=/open/api/file/upload/image : ApiFileTestController.upload(ApiFileTestController.java:105)
[DEBUG] 10:49:57.188 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'apiFileTestController'<class cn.wizzer.app.web.modules.controllers.open.ApiFileTestController>
[DEBUG] 10:49:57.189 org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:184) - Select Html4 Form upload parser --> /open/api/file/upload/image
[DEBUG] 10:49:57.189 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:39) - FastUpload : /open/api/file/upload/image
[DEBUG] 10:49:57.189 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:54) - info created
[DEBUG] 10:49:57.189 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:60) - Params map created - 0 params
[INFO ] 10:49:57.190 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:72) - boundary no found!!

前端没写对,看上去只是强行设置了header,但body并非file upload的格式

来自炫酷的 NutzCN

非常谢谢!

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