Play Framework 2.0中的最大文件上传大小 [英] Max file upload size in Play framework 2.0

查看:84
本文介绍了Play Framework 2.0中的最大文件上传大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

播放框架2.0 中上传大文件(大于1 MB)时,我得到

When I upload large files (greater than 1 MB) in play framework 2.0 I get

"413请求实体太大"错误.

可以请任何人建议如何摆脱这种情况吗?

Could you please anybody suggest how to get rid of this?

谢谢

更新 我已经通过将其添加到application.conf

UPDATE I have solved this issue by adding this to application.conf

parsers.MultipartFormData.maxLength = 10240K

parsers.MultipartFormData.maxLength=10240K

推荐答案

请参见 http://www.playframework.com/documentation/2.0.x/ScalaBodyParsers

或Java版本: http://www.playframework.com/documentation/2.0. x/JavaBodyParsers

提取:

// Accept only 10KB of data.
def save = Action(parse.text(maxLength = 1024 * 10)) { request =>
  Ok("Got: " + text)
}

您可以使用parsers.text.maxLengthapplication.conf中对其进行配置.

And you can configure this in your application.conf using parsers.text.maxLength.

这篇关于Play Framework 2.0中的最大文件上传大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆