【问题标题】:How to send mp3 file using a POST request from android studio to flask server如何使用来自 android studio 的 POST 请求将 mp3 文件发送到烧瓶服务器
【发布时间】:2018-11-26 11:45:38
【问题描述】:

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

【问题讨论】:

  • 100% 与任何其他文件相同。 mp3 没什么特别的

标签: java android python flask


【解决方案1】:

您将使用分段上传来上传 .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 了解更多

【讨论】:

    猜你喜欢
    • 2019-12-24
    • 1970-01-01
    • 2021-09-05
    • 2018-04-05
    • 2016-09-24
    • 1970-01-01
    • 2014-07-23
    • 1970-01-01
    • 2018-07-14
    相关资源
    最近更新 更多