我似乎想不出如何在https://api.pushover.net/1/messages.json POST API中使用base64图像字符串。
到目前为止,我在请求体中使用了token={APPTOKEN}&user={userID}&message=here+is+an+image+attachment&attachment=data:image/jpeg;base64,{base64imagevalue},在请求头中使用了Content-Type: application/x-www-form-urlencoded。但当通知通过时,图像就不可用了。
我已经转到了这个代码上。但仍然没有效果。
{
"token": "xxxxxxx",
"user": "xxxxx",
"title": "xxxTEST",
"message": "This is a test.",
"priority": "2",
"retry": "30",
"expire": "300",
"sound": "alien",
"attachment": {
"mime": "image/jpg",
"data": "image/jpeg;base64,/9....QEB"
}
}当我检查结果时,它显示...
<img src="data:application/octet-stream;base64,eyJtaW1lIj....T0ifQ==">图像显示已损坏。
发布于 2021-03-31 05:19:14
你有没有试过用"Content-Type: application/json“发送?
当我对json内容类型和一个小的jpeg数据进行同样的尝试时,它是成功的。但对于110K的文件,它不适用于我。我也在寻找解决方案。
ps。我知道这不是一个恰当的答案,但我不能“评论”。
https://stackoverflow.com/questions/65250851
复制相似问题