Skip to content

Instantly share code, notes, and snippets.

@emrecelikten
emrecelikten / Application.scala
Last active February 9, 2017 12:47
Sample upload testing in Play Framework 2.3.1
package controllers
import play.api.mvc._
object Application extends Controller {
def upload = Action(parse.multipartFormData) {
request =>
if (request.body.files.isEmpty) BadRequest("Invalid file!")
else if (request.body.asFormUrlEncoded.isEmpty) BadRequest("Invalid data!")
else Ok("Everything is okay!")