NutzCN Logo
问答 使用webupload使用分片上传问题
发布于 162天前 作者 shuxinyun 197 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk

我上传文件不大,不分片上传的时候没有毛病
代码设置如下:

@AdaptBy(type = UploadAdaptor.class, args = {"ioc:imageUpload"})
    @POST
    @At(value = {"/open/upload/?/?/image"},top = true)
    @Ok("json")
    public Object images(String type,String name,@Param("image") TempFile[] files,@Param("")NutMap data, HttpServletRequest req, AdaptorErrorContext err) {
        try {
            if (err != null && err.getAdaptorErr() != null) {
                return Result.error("文件不合法:" + err.toString());
            } else {

当分片传输的时候,这里的err不为空,导致所有数据为null,同时报错如下:

[DEBUG] 2018-07-06 15:46:20,050 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:133) - Upload File info: FilePath=[test.mp4],fieldName=[image]
[DEBUG] 2018-07-06 15:46:20,050 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:137) - Upload Info: name=test.mp4,content_type=application/octet-stream
[INFO ] 2018-07-06 15:46:20,053 org.nutz.mvc.adaptor.AbstractAdaptor.adapt(AbstractAdaptor.java:261) - Adapter Error catched , but I found AdaptorErrorContext param, so, set it to args, and continue
org.nutz.mvc.upload.UploadUnsupportedFileNameException: Unsupport file name 'test.mp4' 
	at org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:140)
	at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:186)
	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)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at cn.wizzer.app.web.commons.processor.NutShiroProcessor.process(NutShiroProcessor.java:52)

不清楚是哪儿不对,请指教!

4 回复

找到 upload.json 后缀名里加上 mp4

撤回~~

应该是 使用 ioc:videoUpload 适配,别用 ioc:imageUpload

理解了!哎

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