我不知道我做错了什么,我只是想把这个curl命令转换成angular post请求中的工作。
curl 命令
curl -F file=@someFile.txt https://store1.gofile.io/uploadFile
Angular 服务方法
url = "https://store1.gofile.io/uploadFile"
getFile(file:File){
return this.http.post(this.url,{
params:{
'file':file
}
});
}
1条答案
按热度按时间egmofgnx1#
您需要以
data
的形式发送文件,而不是以参数的形式发送。如果您有queryParams,您可以将其添加到options
中。这是您要查找的代码。您不需要选项,这只是如果您想实现一个上传进度条/百分比。