TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Aashish Tyagi
NA
26
2.5k
getting null when send image in angular6 to mvc API
Nov 24 2018 2:30 PM
i am getting null when send image in angular6 to mvc API (formdata)
angular6 code function:-
AddUserProfilePic(){
let userID: string = localStorage.getItem("UserID");
const frmData = new FormData();
frmData.append('file', this.uploadedImage);
frmData.append('loginID', userID);
this._userService.AddProfilePic(frmData)
.subscribe(
(responce) => {
if (responce)
alert("responce is" + responce);
});
}
AddProfilePic(formData:FormData) {
const httpOptions = {
headers: new Headers({
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*'
})
};
return this._http.post(SessionService.userApiUrl + "UpdateProfilePic", formData,httpOptions)
.map(
res => res.json()
);
}
c# code
[Route("api/User/UpdateProfilePic")]
[HttpPost]
public IHttpActionResult UpdateProfilePic()
{
System.Web.HttpFileCollection hfc = System.Web.HttpContext.Current.Request.Files;
return Ok(1);
}
hfc.Count value is 0
i am sending two key from client side but in server side we find 0
Reply
Answers (
0
)
Connect to Microsoft SQL Server 2012 with WCF web service
how to send Soap Version in request?