Advertisement
Guest User

Untitled

a guest
Apr 8th, 2014
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.74 KB | None | 0 0
  1. def upload = Action(parse.maxLength(Math.pow(1024, 3).intValue, parse.multipartFormData)) { implicit req ⇒
  2.     req.body match {
  3.       case Left(MaxSizeExceeded(length)) => NotAcceptable
  4.       case Right(multipartForm) =>
  5.         multipartForm.file("videoFile").map { tmpFile: FilePart[play.api.libs.Files.TemporaryFile]
  6.           userid(req) match {
  7.             case Some(advisor)
  8.               CDNUpload.push(advisor, new ObjectId, tmpFile) match {
  9.                 case Right((file, target, video))
  10.                   Ok(Json.obj("video" -> video))
  11.                 case Left(msg) ⇒ BadRequest(Messages("video.upload.error"))
  12.               }
  13.             case _ ⇒ Unauthorized
  14.           }
  15.         } getOrElse BadRequest
  16.     }
  17.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement