Skip to content
Advertisement

How can i get formdata with .net core web api and vue.js

I am trying to write an announcement system. i am using vue 2 and net core 3.1. The announcement has a photo, title, and content. (The department id field is static for now.) I’m trying to send the announcement’s information with the photo in the formdata, but the api can only capture the photo. So where am I going wrong? This is my vue component:

JavaScript

and this is my api controller:

JavaScript

and this is Notice Entity:

JavaScript

Advertisement

Answer

for this blog:Upload file using vue js ASP.NET Core

you can use the follow code:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement