i want to upload image and save in database as byte[]
1: working on registration form in which i have other fields also
Name of the Applicant*
Address*
Email*
Photograph*
var db = new DatabaseContext();
var applicant = new Applicant();
applicant.Name = txtname.Text;
applicant.Address = txtadress.Text;
applicant.Email = txtemail.Text;
db.Applicant.Add(applicant);
db.SaveChanges();
}
Now,how can i implement?
Sachin SinghPosted Jan 16, 2023, 1:31 PM
first make sure your ProfilePic (image column) property is of byte[] type inside your Applicant Class.
after that do it like this
Pasang TamangPosted Jan 16, 2023, 1:42 PM
Hi,
Please check below link. This explains how you can upload and save uploaded file into database.
https://www.c-sharpcorner.com/UploadFile/0c1bb2/uploading-images-to-database-using-Asp-Net-C-Sharp/
Regards,
Pasang
Vishal JoshiPosted Jan 16, 2023, 1:03 PM
Hello
You can add below code to upload image to database.
Thank you.