【发布时间】:2020-07-23 13:09:43
【问题描述】:
我正在尝试通过他们的 API 将网络摄像头提要中的 gif 上传到 Giphy,它返回状态 400 -“请提供文件上传或'source_image_url'”。我的功能是这样做的:
upload = new FormData();
upload.append("file", gif, "usergif.gif");
console.log(upload.get("file"));
fetch("https://upload.giphy.com/v1/gifs?file=" upload + "&api_key=" + apiKey, { method: "POST" })
.then(response => {
console.log(response.status);
return response.json;
}
)
upload.append()里面的gif变量的值是recorder.getBlob()(我用的是RecorderRTC API),我也试过用upload.file甚至upload.get("file")作为源,也用@987654327 @ 并在获取请求中将file= 更改为source_image_url=,甚至尝试在不使用FormData() 的情况下发送gif 变量,但没有任何效果。
你有线索吗?
【问题讨论】:
标签: javascript post http-status-code-400 giphy-api