如何使用 Postman 正确使用 raw 上传波形文件?

问题描述

所以,我使用的内容类型为“multipart/form-data; bounding=my_custom_boundary”在我的标题中,并已拆分我的原始数据,如下所示:

--my_custom_boundary
Content-disposition: form-data; name="path"

WAV
--my_custom_boundary
Content-disposition: form-data; name="files"; filename="test3.wav"
Content-Type: audio/wave
Content-transfer-encoding: base64

[my base64 string of the file]

--my_custom_boundary

通过表单数据发送文件时,我得到:

enter image description here

这是正确的,代码正确地将文件识别为 .wav 并继续

当通过上面代码片段中的原始数据发送相同的文件时,我得到了这个:

image

代码失败,因为它无法将其识别为 wav 文件(没有 RIFF 标头且内容长度几乎增加了 50%)

文件通过一个用 c# 编写的 API 作为 HttpPostedFileBase。我想我的原始上传有问题,但据我所知我应该使用 base64,对吗?

仅供参考,如果我将 base64 转换回音频文件,它可以正常播放。所以 base64 字符串本身是正确的。我必须使用 raw 上传文件,我不能使用表单数据文件上传我正在做的测试。

我使用 https://base64.guru/converter/encode/file 来转换文件

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)