NutzCN Logo
问答 文件上传报前台报400
发布于 1950天前 作者 dalichuifeng 1767 次浏览 复制 上一个帖子 下一个帖子
标签:

我也遇到这个问题,怎么处理@wendal
@IocBean
@At("/jnwj")
public class JNWJController {
@AdaptBy(type = UploadAdaptor.class, args = {"ioc:fileUpload"})
@POST
@At({ "/file/?", "/file"})
@Ok("json")
@Filters({@By(type= CrossOriginFilter.class)})
public Object fileUpload(@Param("Filedata") TempFile tf, HttpServletRequest req,
@Param("disksymbol")String disksymbol, AdaptorErrorContext err) throws Exception {
//Http.postFile2(tf,"","");
String name=tf.getSubmittedFileName();
List result= Http.postFile(tf.getFile(),name,"");
if (result !=null && result.size()>0){
return result.get(0);
}
return null;
}
}

前台请求

Request URL: http://www.XXX.com:8080/archives/jnwj/file?alias=third&disksymbol=R:\\
Request Method: POST
Status Code: 400
Remote Address: XXXX:8080
Referrer Policy: no-referrer-when-downgrade
Accept: /
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: keep-alive
Content-Length: 40058
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary2QtQGh4vNjhRg7p8
Cookie: sid=a698a3af-282a-40df-a67a-6eab67d6837b
Host: www.XXX.com:8080
Origin: http://www.XXX.com:8080
Referer: http://www.XXX.com:8080/archives/app/arrange/archivescode?tenantid=510503&staff_id=7cf17b2f8f6447e3b17d252d73bcec75&staff_name=%E8%B6%85%E5%9B%BE%E7%BA%B3%E6%BA%AA&areacode=510503
User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.103 Safari/537.36
X-Requested-With: XMLHttpRequest
alias: third
disksymbol: R:\
Filedata: (binary)

3 回复

论坛逛了下说是参数不对?我本地调试没问题,一到正式环境就不行

R:\不是合法的url参数吧

@wendal 是的本地和正式的参数搞错了,谢谢,大神

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