Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
595 views
in Technique[技术] by (71.8m points)

playframework 2.0 - Max file upload size in Play framework 2.0

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

"413 Request Entity Too Large" error.

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

Thanks,

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

#Set Max file size

parsers.MultipartFormData.maxLength=10240K

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

See http://www.playframework.com/documentation/2.0.x/ScalaBodyParsers

or Java version: http://www.playframework.com/documentation/2.0.x/JavaBodyParsers

extract:

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

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...