NutzCN Logo
问答 nutz+ajaxFileupload 上传问题
发布于 2754天前 作者 qq_99c1b36f 2166 次浏览 复制 上一个帖子 下一个帖子
标签:

今天要做图片上传。因为页面上是要弹出模态框,所以考虑必须用ajax异步请求,使用的是ajaxfileUpload插件。但是,后台拿不到任何值,不知道是不是我的写法不对。望指点

/**
	 * 文件上传
	 * @return
	 */
	@At("/newProduct/fileUpload")
	@AdaptBy(type = UploadAdaptor.class, args = { "${ctx}/WEB-INF/tmp" })
	@Ok("raw:json")
	public Object fileUpload(@Param("token") String token, @Param("myfile") File file,HttpServletRequest req){
		String aaa = req.getParameter("token");
		HttpSession session = req.getSession();
		Object obj = session.getAttribute("org.nutz.mvc.upload.UploadInfo");
		System.out.println(aaa);
		System.out.println(token);
		System.out.println(file);
		String result = "";
	    String url = UrlConstant.MAIN_API+"upload_token";
	    
		/*String data = "teamId="+team_id+"&token="+token+"&mode=team_catalog";
		String url = UrlConstant.MAIN_API+"upload_token";
        result = HttpRequestUtil.sendGet(url, data);*/
		return Json.toJson(result);
	}

/*-----------------------------------------------------------------------页面代码----------------------------------------------------------------------*/

$.ajaxFileUpload({
            url:"${ctx}/newProduct/fileUpload?token="+$file_uptoken,//用于文件上传的服务器端请求地址
            type: "POST",
            secureuri:false,//一般设置为false
            fileElementId:"input-img",//文件上传控件的id属性  <input type="file" id="input-img" name="upload" />
            dataType: "json",
            success: function (message){//服务器成功响应处理函数
                console.log(message);
            },
            error: function (data, status, e){//服务器响应失败处理函数
                alert(e);
            }
        });
38 回复

@wendal 又得麻烦大神了 - -

换webupload,中文文档

@wendal webupload昨天写了个demo,发现发开windows文件窗口时好慢,而且我js水平渣渣,还是ajaxFileupload好使点。我java代码没有问题吗?

@wendal 我java代码里,三个打印全是null、郁闷。。。

前端问题,并非后端的问题, 看日志就知道了

我将token放在url里,也没拿到,打印null,这是为啥啊

是不是根本没走ajaxFileUpload哦?

ajaxFileUpload的url和后台匹配啊,它既然触发了请求,肯定走了

跟form的action也匹配上了? 是不是走form了?

我没写form,ajaxFileUpload可以直接帮id那个input的id,而且我要异步请求,不能刷新页面,所以也不能写form

好吧,我觉得是没走哦... 要不你写错url试试?

晕,改了url后,还是进action里了,这是为什么

所以根本没走嘛

那为啥会进action啊

所以我觉得你加了form呗

我明明把input放在form外面

submit按钮在form里面?

嗯,确实,我晕,难道我下载了一个假的ajaxfileupload

@wendal 听你的,我换成了webuploader,想批量上传图片,但是,不知道怎么了,进不去action
----------------------------------------------------------1.action代码--------------------------------------------------------------

/**
	 * 文件上传
	 * @return
	 */
	@At("/newProduct/fileUpload")
	@AdaptBy(type = UploadAdaptor.class, args = { "${ctx}/WEB-INF/tmp" })
	@Ok("raw:json")
	public Object fileUpload(@Param("token") String token, @Param("file") Object file,HttpServletRequest req){
		HttpSession session = req.getSession();
		Object obj = session.getAttribute("org.nutz.mvc.upload.UploadInfo");
		System.out.println(token);
		System.out.println(file);
		String result = "";
	    String url = UrlConstant.MAIN_API+"upload_token";
	    
		/*String data = "teamId="+team_id+"&token="+token+"&mode=team_catalog";
		String url = UrlConstant.MAIN_API+"upload_token";
        result = HttpRequestUtil.sendGet(url, data);*/
		return Json.toJson(result);
	}

--------------------------------------------------------------2.java 控制台:--------------------------------------------------------------------

2017-5-2 23:15:54.395 DEBUG [http-apr-8080-exec-1] Search mapping for [POST] path=/${ctx}/newProduct/fileUpload : NOT Action match
2017-5-2 23:15:54.411 DEBUG [http-apr-8080-exec-2] Search mapping for [POST] path=/${ctx}/newProduct/fileUpload : NOT Action match
2017-5-2 23:15:54.424 DEBUG [http-apr-8080-exec-4] Search mapping for [POST] path=/${ctx}/newProduct/fileUpload : NOT Action match

---------------------------------------------------------------------------------3.jsp+js部分代码---------------------------------------------------------------
1.页面js代码

// 实例化
        uploader = WebUploader.create({
            pick: {
                id: '#filePicker',
                label: '点击选择图片'
            },
            formData: {
                uid: 123
            },
            dnd: '#dndArea',
            paste: '#uploader',
            swf: './Uploader.swf',
            chunked: false,
            chunkSize: 512 * 1024,
            server: '${ctx}/newProduct/fileUpload?token='+$file_uptoken,
            // runtimeOrder: 'flash',

            //添加文件格式检验
            accept: {
                //title: 'Images',
                extensions: 'gif,jpg,jpeg,bmp,png'
                //mimeTypes: 'image/*'    //这句话会让打开本地资源变慢
            },

            // 禁掉全局的拖拽功能。这样不会出现图片拖进页面的时候,把图片打开。
            disableGlobalDnd: true,
            fileNumLimit: 300,
            fileSizeLimit: 200 * 1024 * 1024,    // 200 M
            fileSingleSizeLimit: 50 * 1024 * 1024    // 50 M
        });

2.webuploader部分源码

Transport.options = {
            server: '',
            method: 'POST',
    
            // 跨域时,是否允许携带cookie, 只有html5 runtime才有效
            withCredentials: false,
            fileVal: 'file',
            timeout: 2 * 60 * 1000,    // 2分钟
            formData: {},
            headers: {},
            sendAsBinary: true  //开启二进制传输文件
        };

求指导!

js里面是没有el/jsp语法的

在jsp里面定义一个js变量

var ctx = "${ctx}";

谢谢,该了后,果然好多 了,之前我一直这么写都没问题,我想可能是之前虽然在js代码里也这么写,但是属于jsp页面的一部分,而刚好这次的${ctx}写在外部引入的js文件里。

但是,又get到新的问题了 - -

java.lang.RuntimeException: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg
	at org.nutz.lang.Lang.wrapThrow(Lang.java:181)
	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:226)
	at org.nutz.mvc.upload.UploadAdaptor.adapt(UploadAdaptor.java:117)

要贴就贴完整

F2017-5-2 23:58:55.631 DEBUG [http-apr-8080-exec-8] Found mapping for [GET] path=/newProduct : NewProduct.loadImgs(NewProduct.java:45)
productPurview:{"read":true,"audit":true,"publish":true,"recall":true,"create":true,"update":true,"destroy":true}
2017-5-2 23:58:58.645 DEBUG [http-apr-8080-exec-1] Found mapping for [GET] path=/newProduct/loadStaticPrice : NewProduct.loadStaticPrice(NewProduct.java:180)
2017-5-2 23:59:0.330 DEBUG [http-apr-8080-exec-3] Found mapping for [GET] path=/newProduct/getFileToken : NewProduct.getFileToken(NewProduct.java:207)
2017-5-2 23:59:4.321 DEBUG [http-apr-8080-exec-9] Found mapping for [POST] path=/newProduct/fileUpload : NewProduct.fileUpload(NewProduct.java:222)
17-05-02 23:59:04.325 WARN [http-apr-8080-exec-9] Error@/newProduct/fileUpload :
java.lang.RuntimeException: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg
	at org.nutz.lang.Lang.wrapThrow(Lang.java:181)
	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:226)
	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:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	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:44)
	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:198)
	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:218)
	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:169)
	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:442)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1083)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:640)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)

	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)
	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)
Caused by: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg
	at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:199)
	... 34 more
2017-5-3 0:2:35.544 DEBUG [http-apr-8080-exec-6] Found mapping for [POST] path=/newProduct/fileUpload : NewProduct.fileUpload(NewProduct.java:222)
17-05-03 00:02:35.554 WARN [http-apr-8080-exec-6] Error@/newProduct/fileUpload :
java.lang.RuntimeException: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg
	at org.nutz.lang.Lang.wrapThrow(Lang.java:181)
	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:226)
	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:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	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:44)
	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:198)
	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:218)
	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:169)
	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:442)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1083)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:640)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)

	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)
	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)
Caused by: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg
	at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:199)
	... 34 more
2017-5-3 0:2:35.572 DEBUG [http-apr-8080-exec-2] Found mapping for [POST] path=/newProduct/fileUpload : NewProduct.fileUpload(NewProduct.java:222)
17-05-03 00:02:35.572 WARN [http-apr-8080-exec-2] Error@/newProduct/fileUpload :
java.lang.RuntimeException: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg
	at org.nutz.lang.Lang.wrapThrow(Lang.java:181)
	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:226)
	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:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	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:44)
	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:198)
	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:218)
	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:169)
	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:442)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1083)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:640)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)

	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)
Caused by: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg
	at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:199)
	... 34 more
2017-5-3 0:3:9.150 DEBUG [http-apr-8080-exec-1] Found mapping for [GET] path=/newProduct : NewProduct.loadImgs(NewProduct.java:45)
productPurview:{"read":true,"audit":true,"publish":true,"recall":true,"create":true,"update":true,"destroy":true}
2017-5-3 0:3:12.362 DEBUG [http-apr-8080-exec-10] Found mapping for [GET] path=/newProduct/loadStaticPrice : NewProduct.loadStaticPrice(NewProduct.java:180)
2017-5-3 0:3:14.310 DEBUG [http-apr-8080-exec-2] Found mapping for [GET] path=/newProduct/getFileToken : NewProduct.getFileToken(NewProduct.java:207)
2017-5-3 0:3:20.735 DEBUG [http-apr-8080-exec-8] Found mapping for [POST] path=/newProduct/fileUpload : NewProduct.fileUpload(NewProduct.java:222)
17-05-03 00:03:20.735 WARN [http-apr-8080-exec-8] Error@/newProduct/fileUpload :
java.lang.RuntimeException: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg
	at org.nutz.lang.Lang.wrapThrow(Lang.java:181)
	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:226)
	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:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	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:44)
	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:198)
	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:218)
	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:169)
	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:442)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1083)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:640)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)

	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)
	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)
Caused by: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg
	at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:199)
	... 34 more
2017-5-3 0:3:20.774 DEBUG [http-apr-8080-exec-9] Found mapping for [POST] path=/newProduct/fileUpload : NewProduct.fileUpload(NewProduct.java:222)
17-05-03 00:03:20.774 WARN [http-apr-8080-exec-9] Error@/newProduct/fileUpload :
java.lang.RuntimeException: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg
	at org.nutz.lang.Lang.wrapThrow(Lang.java:181)
	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:226)
	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:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)

	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:44)
	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:198)
	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:218)
	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:169)
	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:442)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1083)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:640)

	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)
	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)
Caused by: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg
	at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:199)
	... 34 more
2017-5-3 0:3:31.386 DEBUG [http-apr-8080-exec-1] Found mapping for [GET] path=/newProduct : NewProduct.loadImgs(NewProduct.java:45)
productPurview:{"read":true,"audit":true,"publish":true,"recall":true,"create":true,"update":true,"destroy":true}
2017-5-3 0:3:34.439 DEBUG [http-apr-8080-exec-5] Found mapping for [GET] path=/newProduct/loadStaticPrice : NewProduct.loadStaticPrice(NewProduct.java:180)
2017-5-3 0:3:36.617 DEBUG [http-apr-8080-exec-6] Found mapping for [GET] path=/newProduct/getFileToken : NewProduct.getFileToken(NewProduct.java:207)
2017-5-3 0:3:42.856 DEBUG [http-apr-8080-exec-2] Found mapping for [POST] path=/newProduct/fileUpload : NewProduct.fileUpload(NewProduct.java:222)
17-05-03 00:03:42.857 WARN [http-apr-8080-exec-2] Error@/newProduct/fileUpload :
java.lang.RuntimeException: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg
	at org.nutz.lang.Lang.wrapThrow(Lang.java:181)
	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:226)
	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:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	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:44)
	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:198)
	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:218)
	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:169)
	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:442)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1083)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:640)

	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)
	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)
Caused by: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg

	at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:199)
	... 34 more
2017-5-3 0:3:42.901 DEBUG [http-apr-8080-exec-4] Found mapping for [POST] path=/newProduct/fileUpload : NewProduct.fileUpload(NewProduct.java:222)
17-05-03 00:03:42.901 WARN [http-apr-8080-exec-4] Error@/newProduct/fileUpload :
java.lang.RuntimeException: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg
	at org.nutz.lang.Lang.wrapThrow(Lang.java:181)
	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:226)
	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:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)

	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:44)
	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:198)
	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:218)
	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:169)
	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:442)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1083)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:640)

	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)
	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)
Caused by: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg

	at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:199)
	... 34 more
2017-5-3 0:4:3.497 DEBUG [http-apr-8080-exec-7] Found mapping for [GET] path=/newProduct : NewProduct.loadImgs(NewProduct.java:45)
productPurview:{"read":true,"audit":true,"publish":true,"recall":true,"create":true,"update":true,"destroy":true}
2017-5-3 0:4:6.196 DEBUG [http-apr-8080-exec-9] Found mapping for [GET] path=/newProduct/loadStaticPrice : NewProduct.loadStaticPrice(NewProduct.java:180)
2017-5-3 0:4:7.920 DEBUG [http-apr-8080-exec-10] Found mapping for [GET] path=/newProduct/getFileToken : NewProduct.getFileToken(NewProduct.java:207)
2017-5-3 0:4:13.349 DEBUG [http-apr-8080-exec-5] Found mapping for [POST] path=/newProduct/fileUpload : NewProduct.fileUpload(NewProduct.java:222)
17-05-03 00:04:13.350 WARN [http-apr-8080-exec-5] Error@/newProduct/fileUpload :
java.lang.RuntimeException: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg
	at org.nutz.lang.Lang.wrapThrow(Lang.java:181)
	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:226)
	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:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	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:44)
	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:198)
	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:218)
	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:169)
	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:442)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1083)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:640)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)

	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)
	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)
Caused by: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg
	at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:199)
	... 34 more
2017-5-3 0:4:13.396 DEBUG [http-apr-8080-exec-6] Found mapping for [POST] path=/newProduct/fileUpload : NewProduct.fileUpload(NewProduct.java:222)
17-05-03 00:04:13.396 WARN [http-apr-8080-exec-6] Error@/newProduct/fileUpload :
java.lang.RuntimeException: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg
	at org.nutz.lang.Lang.wrapThrow(Lang.java:181)
	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:226)
	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:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	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:44)
	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:198)
	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:218)
	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:169)
	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:442)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1083)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:640)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2517)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2506)

	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)
Caused by: org.nutz.mvc.upload.UploadException: Unknow Content-Type : image/jpeg
	at org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:199)
	... 34 more

这是啥玩意,关掉

sendAsBinary: true  //开启二进制传输文件

图片不就是二进制么

我还特意改了webuploader源码 - -

大神就是大神啊,膜拜- -

2017-5-3 0:11:29.510 DEBUG [http-apr-8080-exec-3] Found mapping for [POST] path=/newProduct/fileUpload : NewProduct.fileUpload(NewProduct.java:222)
2017-5-3 0:11:29.511 DEBUG [http-apr-8080-exec-3] Select Html4 Form upload parser --> /yunlu/newProduct/fileUpload
2017-5-3 0:11:29.517 DEBUG [http-apr-8080-exec-3] FastUpload : /newProduct/fileUpload
2017-5-3 0:11:29.518 DEBUG [http-apr-8080-exec-3] info created
2017-5-3 0:11:29.519 DEBUG [http-apr-8080-exec-3] Params map created - 1 params
2017-5-3 0:11:29.520 DEBUG [http-apr-8080-exec-3] boundary: 
------WebKitFormBoundary9j5zxFNnlKJ8PUBb
2017-5-3 0:11:29.525 DEBUG [http-apr-8080-exec-3] skip first boundary
2017-5-3 0:11:29.525 DEBUG [http-apr-8080-exec-3] Reading...
2017-5-3 0:11:29.526 DEBUG [http-apr-8080-exec-3] Upload File info: FilePath=[null],fieldName=[token]
2017-5-3 0:11:29.526 DEBUG [http-apr-8080-exec-3] Found a param, name=[token] value=[]
2017-5-3 0:11:29.526 DEBUG [http-apr-8080-exec-3] Upload File info: FilePath=[null],fieldName=[id]
2017-5-3 0:11:29.526 DEBUG [http-apr-8080-exec-3] Found a param, name=[id] value=[WU_FILE_0]
2017-5-3 0:11:29.527 DEBUG [http-apr-8080-exec-3] Upload File info: FilePath=[null],fieldName=[name]
2017-5-3 0:11:29.527 DEBUG [http-apr-8080-exec-3] Found a param, name=[name] value=[u=1125525258,2963673887&fm=23&gp=0.jpg]
2017-5-3 0:11:29.527 DEBUG [http-apr-8080-exec-3] Upload File info: FilePath=[null],fieldName=[type]
2017-5-3 0:11:29.527 DEBUG [http-apr-8080-exec-3] Found a param, name=[type] value=[image/jpeg]
2017-5-3 0:11:29.527 DEBUG [http-apr-8080-exec-3] Upload File info: FilePath=[null],fieldName=[lastModifiedDate]
2017-5-3 0:11:29.527 DEBUG [http-apr-8080-exec-3] Found a param, name=[lastModifiedDate] value=[Tue May 02 2017 20:54:19 GMT+0800 (中国标准时间)]
2017-5-3 0:11:29.528 DEBUG [http-apr-8080-exec-3] Upload File info: FilePath=[null],fieldName=[size]
2017-5-3 0:11:29.528 DEBUG [http-apr-8080-exec-3] Found a param, name=[size] value=[19514]
2017-5-3 0:11:29.528 DEBUG [http-apr-8080-exec-3] Upload File info: FilePath=[u=1125525258,2963673887&fm=23&gp=0.jpg],fieldName=[file]
2017-5-3 0:11:29.528 DEBUG [http-apr-8080-exec-3] Upload Info: name=u=1125525258,2963673887&fm=23&gp=0.jpg,content_type=image/jpeg
2017-5-3 0:11:29.537 DEBUG [http-apr-8080-exec-3] ...Done 20399 bytes readed
["", ""]
org.nutz.mvc.upload.TempFile@6d050675
五月 03, 2017 12:11:44 上午 com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource getPoolManager
信息: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 2, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 1000, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> 1hge15z9n1k104oy9r8g70|157995f4, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge15z9n1k104oy9r8g70|157995f4, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql://localhost:3306/myblog?useUnicode=true&characterEncoding=utf8, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 10, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ]
五月 03, 2017 12:11:45 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [org/springframework/jdbc/support/sql-error-codes.xml]
五月 03, 2017 12:11:45 上午 org.springframework.jdbc.support.SQLErrorCodesFactory <init>
信息: SQLErrorCodes loaded: [DB2, Derby, H2, HSQL, Informix, MS-SQL, MySQL, Oracle, PostgreSQL, Sybase, Hana]

谢谢,大神早点休息,我再撸会代码- -

@wendal 公司有总服务器,我拿到上传的文件,得用一个上传的api发到那里去。又get新的问题。。。百度了,没搞懂哪里出问题了
-------------------------------------------------------------------1.nutz action------------------------------------------------------------

@At("/newProduct/fileUpload")
	@AdaptBy(type = UploadAdaptor.class, args = { "${app.root}/WEB-INF/tmp","8192", "UTF-8", "10" })
	@Ok("raw:json")
	public Object fileUpload(@Param("uid") String token, @Param("file") File file,HttpServletRequest req){
		System.out.println("token参数:"+token);//成功获取
		System.out.println("file参数:"+file);//成功获取
		System.out.println("file参数的className:"+file.getClass().getName());
		String result = "";
	    String urlStr = UrlConstant.MAIN_API+"upload_token?token="+token;
	    HttpClient httpclient = new DefaultHttpClient(); 
	    HttpPost httppost = new HttpPost(urlStr);
        try {  
        	InputStreamEntity reqEntity = new InputStreamEntity(new FileInputStream(file), -1);
        	reqEntity.setContentType("application/octet-stream");
            reqEntity.setChunked(true);
            httppost.setEntity(reqEntity);
            httpclient.getParams().setIntParameter(HttpConnectionParams.SO_TIMEOUT,3000); //超时设置
            System.out.println("executing request " + httppost.getRequestLine());
            HttpResponse response = httpclient.execute(httppost);  
            int statusCode = response.getStatusLine().getStatusCode();  
            System.out.println("服务器返回状态吗:"+statusCode);
            if(statusCode == HttpStatus.SC_OK){  
                System.out.println("服务器正常响应.....");
                  
                HttpEntity resEntity = response.getEntity();  
                result = EntityUtils.toString(resEntity);
                InputStream is = resEntity.getContent();
                BufferedReader reader = new BufferedReader(new InputStreamReader(is));
                String line;
                String result2 = "";
                while((line = reader.readLine()) != null){
                	result2 += line;
                }
                System.out.println("result2;"+result2);
                System.out.println(EntityUtils.toString(resEntity));//httpclient自带的工具类读取返回数据  
                System.out.println(resEntity.getContent());     
                EntityUtils.consume(resEntity);  
            }  
                  
            } catch (ParseException e) {  
                e.printStackTrace();  
            } catch (IOException e) {  
                e.printStackTrace();  
            } finally {  
                try {   
                    httpclient.getConnectionManager().shutdown();   
                } catch (Exception ignore) {  
                      
                }  
            } 
        
		return Json.toJson(result);
	}

---------------------------------------------------------------------2. java console-----------------------------------------------------------------

2017-5-3 9:49:24.364 DEBUG [http-apr-8080-exec-4] Found mapping for [POST] path=/newProduct/fileUpload : NewProduct.fileUpload(NewProduct.java:238)
2017-5-3 9:49:24.364 DEBUG [http-apr-8080-exec-4] Select Html4 Form upload parser --> /yunlu/newProduct/fileUpload
2017-5-3 9:49:24.369 DEBUG [http-apr-8080-exec-4] FastUpload : /newProduct/fileUpload
2017-5-3 9:49:24.370 DEBUG [http-apr-8080-exec-4] info created
2017-5-3 9:49:24.370 DEBUG [http-apr-8080-exec-4] Params map created - 0 params
2017-5-3 9:49:24.372 DEBUG [http-apr-8080-exec-4] boundary: 
------WebKitFormBoundaryqoJB1jP6ztZo2ml4
2017-5-3 9:49:24.376 DEBUG [http-apr-8080-exec-4] skip first boundary
2017-5-3 9:49:24.376 DEBUG [http-apr-8080-exec-4] Reading...
2017-5-3 9:49:24.376 DEBUG [http-apr-8080-exec-4] Upload File info: FilePath=[null],fieldName=[uid]
2017-5-3 9:49:24.377 DEBUG [http-apr-8080-exec-4] Found a param, name=[uid] value=[3l2F6e3bmg_EkYo8scdTIMyVFZQ9XlZBLiCVIVpt:yqKuoO7IWxBoQ0F49EzQ6BrHDSQ=:eyJzY29wZSI6Inl1bmx1LXBydiIsImNhbGxiYWNrVXJsIjoiaHR0cDovL2FwaS55dW5sdTYuY29tL2FwaS92MS90ZWFtLy9waG90b3MiLCJjYWxsYmFja0JvZHkiOiJidWNrZXQ9JChidWNrZXQpJmtleT0kKGtleSkmaGFzaD0kKGV0YWcpJmZuPSQoZm5hbWUpJnNpemU9JChmc2l6ZSkmbWltZV90eXBlPSQobWltZVR5cGUpJmV4dD0kKGV4dCkmdG9rZW49NTIzMDgyNWU0NmM3OWE4ZjIzY2M3NTQyNmVhZDVjZTAmdHlwZT0iLCJkZWFkbGluZSI6MTQ5Mzc3OTczMH0=]
2017-5-3 9:49:24.377 DEBUG [http-apr-8080-exec-4] Upload File info: FilePath=[null],fieldName=[id]
2017-5-3 9:49:24.377 DEBUG [http-apr-8080-exec-4] Found a param, name=[id] value=[WU_FILE_0]
2017-5-3 9:49:24.377 DEBUG [http-apr-8080-exec-4] Upload File info: FilePath=[null],fieldName=[name]
2017-5-3 9:49:24.377 DEBUG [http-apr-8080-exec-4] Found a param, name=[name] value=[Fq.png]
2017-5-3 9:49:24.378 DEBUG [http-apr-8080-exec-4] Upload File info: FilePath=[null],fieldName=[type]
2017-5-3 9:49:24.378 DEBUG [http-apr-8080-exec-4] Found a param, name=[type] value=[image/png]
2017-5-3 9:49:24.378 DEBUG [http-apr-8080-exec-4] Upload File info: FilePath=[null],fieldName=[lastModifiedDate]
2017-5-3 9:49:24.378 DEBUG [http-apr-8080-exec-4] Found a param, name=[lastModifiedDate] value=[Sun Apr 16 2017 16:50:39 GMT+0800 (中国标准时间)]
2017-5-3 9:49:24.378 DEBUG [http-apr-8080-exec-4] Upload File info: FilePath=[null],fieldName=[size]
2017-5-3 9:49:24.379 DEBUG [http-apr-8080-exec-4] Found a param, name=[size] value=[217760]
2017-5-3 9:49:24.379 DEBUG [http-apr-8080-exec-4] Upload File info: FilePath=[Fq.png],fieldName=[file]
2017-5-3 9:49:24.379 DEBUG [http-apr-8080-exec-4] Upload Info: name=Fq.png,content_type=image/png
2017-5-3 9:49:24.422 DEBUG [http-apr-8080-exec-4] ...Done 219000 bytes readed
token参数:3l2F6e3bmg_EkYo8scdTIMyVFZQ9XlZBLiCVIVpt:yqKuoO7IWxBoQ0F49EzQ6BrHDSQ=:eyJzY29wZSI6Inl1bmx1LXBydiIsImNhbGxiYWNrVXJsIjoiaHR0cDovL2FwaS55dW5sdTYuY29tL2FwaS92MS90ZWFtLy9waG90b3MiLCJjYWxsYmFja0JvZHkiOiJidWNrZXQ9JChidWNrZXQpJmtleT0kKGtleSkmaGFzaD0kKGV0YWcpJmZuPSQoZm5hbWUpJnNpemU9JChmc2l6ZSkmbWltZV90eXBlPSQobWltZVR5cGUpJmV4dD0kKGV4dCkmdG9rZW49NTIzMDgyNWU0NmM3OWE4ZjIzY2M3NTQyNmVhZDVjZTAmdHlwZT0iLCJkZWFkbGluZSI6MTQ5Mzc3OTczMH0=
file参数:D:\Tomcat\apache-tomcat-7.0.72\webapps\yunlu\WEB-INF\tmp\00\00\00\00\00\00\00\07.png
file参数的className:java.io.File
executing request POST https://api.yunlu6.com/api/v1/upload_token?token=3l2F6e3bmg_EkYo8scdTIMyVFZQ9XlZBLiCVIVpt:yqKuoO7IWxBoQ0F49EzQ6BrHDSQ=:eyJzY29wZSI6Inl1bmx1LXBydiIsImNhbGxiYWNrVXJsIjoiaHR0cDovL2FwaS55dW5sdTYuY29tL2FwaS92MS90ZWFtLy9waG90b3MiLCJjYWxsYmFja0JvZHkiOiJidWNrZXQ9JChidWNrZXQpJmtleT0kKGtleSkmaGFzaD0kKGV0YWcpJmZuPSQoZm5hbWUpJnNpemU9JChmc2l6ZSkmbWltZV90eXBlPSQobWltZVR5cGUpJmV4dD0kKGV4dCkmdG9rZW49NTIzMDgyNWU0NmM3OWE4ZjIzY2M3NTQyNmVhZDVjZTAmdHlwZT0iLCJkZWFkbGluZSI6MTQ5Mzc3OTczMH0= HTTP/1.1
服务器返回状态吗:406

那是表单upload还是流式upload

一般都是表单upload,得用mulitpart的,何不用nutz的http工具类呢

nutz的http工具类不知道怎么用- -,不熟悉,一直用的httpclient。我试试,你说个名字我去查api

既然熟httpclient那就用呗, 改成mulitpart

额。mulitpart是啥,我不是用form提交的。我还是听你的吧

这是公司文件上传接口的文档。。。。。

QiniuCloud - 上传文件

4.1.0 
向云服务器上传文件,地址:http://upload.qiniu.com

POST
https://giant.dev.yunlu6.com/http://upload.qiniu.com
字段	类型	描述
token	String	
上传凭证

file	File	
文件的二进制数据内容

"文件的二进制数据内容", 那你写得没错的样子, 问你们公司的人吧

控制台打印的信息,大神帮忙看看哪里出问题了

token参数:3l2F6e3bmg_EkYo8scdTIMyVFZQ9XlZBLiCVIVpt:y9Wiz6TPE3wFSRQcIQqArimVqKA=:eyJzY29wZSI6Inl1bmx1LXBydiIsImNhbGxiYWNrVXJsIjoiaHR0cDovL2FwaS55dW5sdTYuY29tL2FwaS92MS90ZWFtLy9waG90b3MiLCJjYWxsYmFja0JvZHkiOiJidWNrZXQ9JChidWNrZXQpJmtleT0kKGtleSkmaGFzaD0kKGV0YWcpJmZuPSQoZm5hbWUpJnNpemU9JChmc2l6ZSkmbWltZV90eXBlPSQobWltZVR5cGUpJmV4dD0kKGV4dCkmdG9rZW49NTIzMDgyNWU0NmM3OWE4ZjIzY2M3NTQyNmVhZDVjZTAmdHlwZT0iLCJkZWFkbGluZSI6MTQ5Mzc4MjY5MX0=
file参数:D:\Tomcat\apache-tomcat-7.0.72\webapps\yunlu\WEB-INF\tmp\00\00\00\00\00\00\00\00.jpg
file参数的className:java.io.File
开始请求 : POST https://api.yunlu6.com/api/v1/upload_token?token=3l2F6e3bmg_EkYo8scdTIMyVFZQ9XlZBLiCVIVpt:y9Wiz6TPE3wFSRQcIQqArimVqKA=:eyJzY29wZSI6Inl1bmx1LXBydiIsImNhbGxiYWNrVXJsIjoiaHR0cDovL2FwaS55dW5sdTYuY29tL2FwaS92MS90ZWFtLy9waG90b3MiLCJjYWxsYmFja0JvZHkiOiJidWNrZXQ9JChidWNrZXQpJmtleT0kKGtleSkmaGFzaD0kKGV0YWcpJmZuPSQoZm5hbWUpJnNpemU9JChmc2l6ZSkmbWltZV90eXBlPSQobWltZVR5cGUpJmV4dD0kKGV4dCkmdG9rZW49NTIzMDgyNWU0NmM3OWE4ZjIzY2M3NTQyNmVhZDVjZTAmdHlwZT0iLCJkZWFkbGluZSI6MTQ5Mzc4MjY5MX0= HTTP/1.1
---------------------------------
请求头;accept: */*
请求头;connection: Keep-Alive
请求头;user-agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)
请求头;Content-type: application/octet-stream
---------------------------------
响应头;Server: nginx/1.10.3
响应头;Date: Wed, 03 May 2017 02:38:34 GMT
响应头;Content-Type: application/json
响应头;Content-Length: 83
响应头;Connection: keep-alive
响应头;Cache-Control: no-cache
响应头;X-Request-Id: 5a838379-8323-4e61-9b14-18bef4deb7e9
响应头;X-Runtime: 0.007219
响应头;Vary: Origin
---------------------------------
服务器返回状态吗:406

你确定token能这样发???

先用postman之类的测试一下

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