When I upload large files (greater than 1 MB) in play framework 2.0 I get
"413 Request Entity Too Large" error.
Cou
I am using an AnyContent
Parser. I had to change to controller
code to following as the configurations didn't work for me
def newQuestion = silhouette.SecuredAction.async(parse.maxLength(1024 * 1024, parse.anyContent)(ActorMaterializer()(ActorSystem("MyApplication")))) {
implicit request => {
println("got request with body:" + request.body)
val anyBodyErrors: Either[MaxSizeExceeded, AnyContent] = request.body
anyBodyErrors match {
case Left(size) => {
Future {
EntityTooLarge(Json.toJson(JsonResultError(messagesApi("error.entityTooLarge")(langs.availables(0)))))
}
}
case Right(body) => {
//val body:AnyContent = request.body
val jsonBodyOption = body.asJson
}
}