File WS-Play框架-如何使用post发送文件
我读过这篇文章,但我不知道如何发送post数据+文件 例如: 我想用这个API上传图像,但我不知道如何上传。我试着这样做:File WS-Play框架-如何使用post发送文件,file,upload,playframework-2.4,File,Upload,Playframework 2.4,我读过这篇文章,但我不知道如何发送post数据+文件 例如: 我想用这个API上传图像,但我不知道如何上传。我试着这样做: val file:File = new File("c:/file/sample.jpg") val postMap = Map( "oauth_consumer_key" -> Seq(apiKey.toString), "oauth_signature_method" -> Seq(oauthSignatureMe
val file:File = new File("c:/file/sample.jpg")
val postMap = Map(
"oauth_consumer_key" -> Seq(apiKey.toString),
"oauth_signature_method" -> Seq(oauthSignatureMethod.toString),
"oauth_signature" -> Seq(oauthSignature.toString),
"oauth_timestamp" -> Seq(oauthTimestAmp.toString),
"oauth_nonce" -> Seq(oauthNonce.toString),
"oauth_token" -> Seq(oauthToken.toString),
"content_type" -> Seq("adult"),
"thumb_format" -> Seq("JPG"),
"thumb_size" -> Seq("350x350"),
"thumb_cropping" -> Seq(0.toString),
"thumb_info" -> Seq(1.toString),
"response_format" -> Seq("JSON"),
"image" -> Seq(file)
)
val bb_SendImg = WS.url("http://www.imagebam.com/sys/API/resource/upload_image").post(postMap)
但这不管用。有什么建议或帮助吗?您不能使用play WS发布多部分数据 它是bug追踪器中最古老的一个
此问题中暴露了一些变通方法。例如,您可以使用。您不能使用play WS发布多部分表单数据 它是bug追踪器中最古老的一个 此问题中暴露了一些变通方法。例如,您可以使用