如何使用从android studio到烧瓶服务器的POST请求发送mp3文件

时间:2018-06-17 10:25:33

标签: java android python flask

我在Raspberry Pi上运行烧瓶服务器。我想使用我的应用程序从Android手机发送一个mp3文件到raspberry pi。我已成功将mp3文件读入InputStream对象。我想知道如何将此对象发送到Pi

1 个答案:

答案 0 :(得分:0)

您将使用分段上传来上传.mp3文件

我建议您使用ION上传到服务器。

实施例

Ion.with(getContext())
.load("POST" , "//your server address)
.setMultipartParameter("key", "value")
.setMultipartFile("name which is used in flask server to distinguish data", "audio/mp3", new File("//location of file"))
.asJsonObject()
.setCallback(...)

请参阅:https://github.com/koush/ion了解更多