我正在使用处理文件上传示例。上传文件时,服务器显示错误:Missing boundary header
这是我正在做的事情:
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"
)
}
}
在我的表格中,我已经这样做了:
@helper.form(action = routes.Application.upload, 'enctype -> "multipart/form-data") {
<input type="file" name="picture">
<p>
<input type="submit">
</p>
}
我在这里做错了什么?