0
votes

I'm using the Handling file upload example. When uploading a file, the server shows an error: Missing boundary header

Here is what i'm doing:

def upload = Action(parse.multipartFormData) {implicit request =>
    request.body.file("picture").map { picture =>
      import java.io.File
      val filename = picture.filename
      val contentType = picture.contentType
      picture.ref.moveTo(new File("/users/pictures"))
      Ok("File uploaded")
    }.getOrElse {
      Redirect(routes.Application.index).flashing(
        "error" -> "Missing file"
      )
    }
  }

and in my form I have done this:

@helper.form(action = routes.Application.upload, 'enctype -> "multipart/form-data") {

<input type="file" name="picture">

<p>
    <input type="submit">
</p>

}

What am I doing wrong here ?

1

1 Answers

0
votes

I created a new Play! project and used your code, and it seemed to work fine (used latest Chrome on OSX). If you didn't have the 'enctype parameter, I would understand that error.

Here's the entire project. See if that works.