This is a sniped from my angular component .ts code where i make my request
This is a sniped from the service function that execute the http request
每次我提出请求时,都会出现错误,显示:http://192.168.1.24:2502/SocialNetwork/Posts/CreatePost的Http错误响应:415不支持的媒体类型
And this is the network tab for a request i made
请任何人可以帮助我吗?
Base64
,因此:getBase64(event) {
let file = event.target.files[0];
let reader = new FileReader();
reader.readAsDataURL(file);
reader.onload = function () {
console.log(reader.result); // This is the actual result of converting your image to base64
};
reader.onerror = function (error) {
console.log('Error: ', error);
};
}
以及您的.html
<input type="..." (change)="getBase64($event)">