The beauty of Play sending a file….

def avatar = Action { request =>
  val img = new File("/path/to/some/location.jpg")
  if (img.exists()) {
    Ok.sendFile(content = img, inline = true)
  } else {
    NotFound
  }
}

Leave a Reply

Your email address will not be published. Required fields are marked *