score:0
Accepted answer
have you considered doing a "map" instead of a match?
fileparams.get("profilepic").map(file => (file.get(), file.contenttype.getorelse("application/octet-stream"), file.name))
this will work in the cases when you do have a file uploaded, and will return none
in the cases where nothing is present
Source: stackoverflow.com
Related Query
- Checking attachments in the request
- How to get the body of post request in Scalatra?
- Tell Swagger that the request body can be a single object or a list of objects
- Scala play http filters: how to find the request body
- How do I get the value of a failed request in Dispatch?
- Understanding the request lifecycle of a Play! application
- AWS S3: Uploading large file fails with ResetException: Failed to reset the request input stream
- What is the difference between idle-timeout and request timeout in akka http configuration?
- Checking the equality of types involving existentials in Scala
- Is there a quick built in way to forward a request in the scala Play framework
- making a GET request to a webservice from the playframework 2.0
- Why makes calling error or done in a BodyParser's Iteratee the request hang in Play Framework 2.0?
- How do you get the size of a Request in Play 2.0.x?
- How to make the type checking at compile time?
- How to get http request header info from the server side with spray RestAPI
- Scala: Checking if 2 variables are of the same type
- How do I make Gatling capture request while reading from the session?
- How to log the body from every request in Play?
- Spray is rejecting my request for the wrong reason (405 but should be 400) when a query parameter on a PUT is the wrong type
- EssentialAction: How to Get the Body of a Request without Parsing It
- Checking if a given element in all the tuples contained in the collection is equal
- Play framework make http request from play server to "somesite.com" and send the response back to the browser
- Method returns NodeBuffer instead of Elem and that violates the type checking rule
- Shapeless : Checking of the Type Constraints of Polymorphic Functions (lifted types)
- HTTP4S client. How to get the exact request and response body
- Passing values from request to all the layers below controller
- Play Framework How to update a the session within a request
- Checking what I have imported in the REPL?
- Checking if a given integer element in all the tuples contained in the collection is in consecutive order
- Does use of Future.successful and Future.failed request a thread from the thread pool managed by the execution context
More Query from same tag
- Do I need to take care of producer-consumer rate-matching when using Akka 1.3's actors?
- Scala: Try till first success on a list
- should play 2 xx App have both build.sbt and build.scala
- What does the SQueryL tilde operator do?
- Akka, Camel and ActiveMQ: throttling consumers
- How to include jars under lib in multi-project sbt setup?
- What is a sealed trait?
- Filter groups by size after using groupby function in Scala
- infix notation sometimes doesn't work in scala, why is that?
- Why does Scala reify not work as according to the docs?
- scala: how to iterate typesafe config list
- Inserting pirmary key for Table with auto-increment
- Authentication for controllers.Assets.versioned
- How to implement enums in scala slick 3?
- Is it possible to keep only one evolution file for two databases in Play! framework?
- Parse Play form errors from Scala.js
- How to implement Ordered properly
- PayPal for Play2 / Scala
- Scala Kleisli throws an error in IntelliJ
- How to create AJAX edit form in scala lift for one to many relationship?
- Splitting complex String Pattern (without regex) in a functional approach
- Spark: Writing RDD Results to File System is Slow
- Pattern Match "return" value
- Parsing a CSV string while ignoring commas inside the individual columns
- How to define class method with partially applied function?
- Turning Map("a" -> 2, "b" -> 1) into seq("a","a","b") using map
- Scala SWT project with SBT
- Copying almost identical objects in Scala (aka. How to package models for REST)?
- How to create a shortcut to existing annotation?
- "using" function