NutzCN Logo
问答 from 表单上传文件
发布于 2370天前 作者 qq_0fa9ea23 2139 次浏览 复制 上一个帖子 下一个帖子
标签:
 <form id="addForm" role="form" class="form-horizontal parsley-form" data-parsley-validate enctype="multipart/form-data"
                  action="${base}/platform/sms/send/addDo" method="post">
  <div class="col-sm-8">
                                <div id="queue"></div>
                                <div>
                                    <input id="file_upload" name="file_upload" type="file"  multiple="false">
                                </div>
                                <input type="hidden" id="task_path" name="task_path" value="" >
                                <a href="${base!}/assets/model/mobile.xls" target="_blank"  style="color: #0a6aa1">下载模板文件</a>
                            </div>
 @At("/addDo")
    @Ok("json")
    @RequiresPermissions("sms.business.send.add")
    @AdaptBy(type=WhaleAdaptor.class)
    @SLog(tag = "Sms_send", msg = "手机号:${args[0].mobile},短信类型:${args[0].sms_type},短信签名:${args[0].signId},短信内容:${args[0].sms_content}")
    public Object addDo(@Param("..")Sms_send smsSend,@Param("Filedata") TempFile tf, @Param("task_path")String task_path,HttpServletRequest req) {

后台没有接受到文件,tf 显示为null 这是为什么?

7 回复

表单里面写的名字叫file_upload

file_upload 试过了,也是null

 public Object addDo(@Param("..")Sms_send smsSend,@Param("file_upload") TempFile file_upload, @Param("task_path")String task_path,HttpServletRequest req) {

file_upload = null

日志发一下看看

[DEBUG] 16:03:24.756 org.apache.zookeeper.ClientCnxn$SendThread.readResponse(ClientCnxn.java:742) - Got ping response for sessionid: 0x1643eca725f001b after 0ms
[DEBUG] 16:03:27.207 org.apache.shiro.web.servlet.SimpleCookie.readValue(SimpleCookie.java:389) - Found 'sid' cookie value [v8r6u0c69mj65rpsbhmmq05s61]
[DEBUG] 16:03:27.246 org.nutz.plugins.cache.impl.lcache.LCache.fire(LCache.java:96) - fire channel=LCache:shiro-activeSessionCache msg=vb4rfpdavqg1eqvvptr95387fq:v8r6u0c69mj65rpsbhmmq05s61
[DEBUG] 16:03:27.247 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=vb4rfpdavqg1eqvvptr95387fq:v8r6u0c69mj65rpsbhmmq05s61
[DEBUG] 16:03:27.250 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [POST] path=/platform/sms/send/addDo : SmsSendController.addDo(SmsSendController.java:126)
[DEBUG] 16:03:27.254 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'smsSendController'<class cn.wizzer.app.web.modules.controllers.platform.sms.SmsSendController>
[DEBUG] 16:03:27.271 org.apache.shiro.realm.AuthorizingRealm.getAuthorizationCacheLazy(AuthorizingRealm.java:234) - No authorizationCache instance set.  Checking for a cacheManager...
[DEBUG] 16:03:27.272 org.apache.shiro.realm.AuthorizingRealm.getAuthorizationCacheLazy(AuthorizingRealm.java:248) - No cache or cacheManager properties have been set.  Authorization cache cannot be obtained.
[DEBUG] 16:03:27.281 com.alibaba.dubbo.remoting.transport.DecodeHandler.decode(DecodeHandler.java:59) -  [DUBBO] Decode decodeable message com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcResult, dubbo version: 2.6.2, current host: 192.168.20.33
[DEBUG] 16:03:27.302 com.alibaba.dubbo.remoting.transport.DecodeHandler.decode(DecodeHandler.java:59) -  [DUBBO] Decode decodeable message com.alibaba.dubbo.rpc.protocol.dubbo.DecodeableRpcResult, dubbo version: 2.6.2, current host: 192.168.20.33
[DEBUG] 16:03:27.302 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:39) - FastUpload : /platform/sms/send/addDo
[DEBUG] 16:03:27.306 org.nutz.plugins.cache.impl.lcache.LCache.fire(LCache.java:96) - fire channel=LCache:shiro-activeSessionCache msg=vb4rfpdavqg1eqvvptr95387fq:v8r6u0c69mj65rpsbhmmq05s61
[DEBUG] 16:03:27.306 org.nutz.plugins.cache.impl.lcache.CachePubSub.onPMessage(CachePubSub.java:15) - channel=LCache:shiro-activeSessionCache, msg=vb4rfpdavqg1eqvvptr95387fq:v8r6u0c69mj65rpsbhmmq05s61
[DEBUG] 16:03:27.306 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:54) - info created
[DEBUG] 16:03:27.307 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:60) - Params map created - 0 params
[DEBUG] 16:03:27.307 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:77) - boundary: 
------WebKitFormBoundaryiM5u0yVAfV7mzk1d
[DEBUG] 16:03:27.307 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:100) - skip first boundary
[DEBUG] 16:03:27.308 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:111) - Reading...
[DEBUG] 16:03:27.308 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:133) - Upload File info: FilePath=[null],fieldName=[signId]
[DEBUG] 16:03:27.309 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:214) - Found a param, name=[signId] value=[408f07c5227945478d85147cd079804e]
[DEBUG] 16:03:27.309 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:133) - Upload File info: FilePath=[null],fieldName=[content]
[DEBUG] 16:03:27.309 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:214) - Found a param, name=[content] value=[【西游记】sdfsf]
[DEBUG] 16:03:27.310 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:133) - Upload File info: FilePath=[null],fieldName=[mobile]
[DEBUG] 16:03:27.310 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:214) - Found a param, name=[mobile] value=[15755901779]
[DEBUG] 16:03:27.310 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:133) - Upload File info: FilePath=[null],fieldName=[file_upload]
[DEBUG] 16:03:27.311 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:214) - Found a param, name=[file_upload] value=[]
[DEBUG] 16:03:27.311 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:133) - Upload File info: FilePath=[null],fieldName=[task_path]
[DEBUG] 16:03:27.311 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:214) - Found a param, name=[task_path] value=[/budiot_sms/file/xls/20180627160316.xls]
[DEBUG] 16:03:27.314 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:133) - Upload File info: FilePath=[null],fieldName=[sms_type]
[DEBUG] 16:03:27.314 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:214) - Found a param, name=[sms_type] value=[0]
[DEBUG] 16:03:27.320 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:133) - Upload File info: FilePath=[null],fieldName=[upAt_t]
[DEBUG] 16:03:27.320 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:214) - Found a param, name=[upAt_t] value=[]
[DEBUG] 16:03:27.320 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:231) - ...Done 809 bytes readed

解决了。。。。我用uploadifive 插件上传过一次,再次提交时,文件内容就没了

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