How to Upload Image using Webmethod
[WebMethod]
public string MarkAttendance (string Location,string UserImageUrl, string UserSelfImgaeBase64)
{
string strFileDir = "Doc\\" + Location + "\\";
DirectoryInfo di = new DirectoryInfo(HttpContext.Current.Server.MapPath(strFileDir));
if (di.Exists == false)
{
di.Create();
}
byte[] imageBytes = Convert.FromBase64String(UserSelfImgaeBase64);
string filePath = Path.Combine(di.FullName, UserImageUrl);
File.WriteAllBytes(filePath, imageBytes);
try
{
return "In Punch Successfully Marked ! ";
}
}
catch (Exception ex)
{
return "Error : " + ex.Message;
}
}