NutzCN Logo
问答 上传文件同时post过去一个对象,文件能成功接受,对象一直为空,对象不是form提交,是放在ajax的data部分
发布于 2834天前 作者 qq_7a5ddda8 2486 次浏览 复制 上一个帖子 下一个帖子
标签:
这个位置贴代码或日志,不要移除前后标识符

@At("/create-comment")
@POST
@AdaptBy(type = WhaleAdaptor.class, args = { "${app.root}/WEB-INF/tmp" })
public void commentCreateBatch(@Param("..") ZombieComment zombieComment, @Param("commentfile") TempFile f) {
log.debug("ZombieComment : " + Json.toJson(zombieComment));
log.debug("TempFile" + f);
}
//下面是ajax内容
$("#uploadComBtn").click(function(){
console.log("zombieComment info");
console.log(zombieComment);
//return;
$.ajaxFileUpload({
url:"zom/create-comment",
fileElementId:"commentfile",
secureuri:false,
dataType:"json",
data:JSON.stringify(zombieComment),
success:function(data, status){
console.log("上传成功");
},
error:function(data, status, e){
alert(e);
console.log("错了!上传出错");
}
});
});

1 回复

好吧,这么明显的提示还是贴错...

贴后台的日志.

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