in app/controllers/Application.scala [32:55]
def uploadChart = AuthAction (parse.maxLength(parse.DefaultMaxDiskLength, parse.multipartFormData)) { request =>
request.body match {
case Left(MaxSizeExceeded(limit)) => {
EntityTooLarge(views.html.tooLarge(request.user, bytesToMb(limit)))
}
case Right(multipartForm) => {
val uploads : Seq[S3UploadResponse] = multipartForm.files.map { f =>
val temporaryFilePath = Paths.get(s"/tmp/${f.filename}")
f.ref.moveTo(temporaryFilePath, replace = true)
val res = s3Actions.upload(temporaryFilePath.toFile, request.user, ChartsToolConfig, setPublicAcl = true)
Files.delete(temporaryFilePath)
res
}
uploads.head match {
case failure: S3UploadFailure => InternalServerError(Json.toJson(failure))
case success: S3UploadSuccess => Ok(Json.toJson(success))
}
}
}
}