Click here to Skip to main content
15,891,316 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have name no and profile pic to insetrt into database
how can i insert all at a time into database
converting the image into bytes
Posted

 
Share this answer
 
v2
Comments
Member 11970398 18-Nov-15 6:45am    
i have registration page the upload image file go with all other input file like name no .... at a time and insert into database

dont know wehere to write the method to convert the image into bytes
[no name] 18-Nov-15 6:54am    
Did you go through the links I provided above. In 1st link it is described how an image convert to byte array.
Read my previous solution here:
How Do I Make Mvc Image Upload System[^]

And for converting Image to Byte[]:
C# Image to Byte Array and Byte Array to Image Converter Class[^]

-KR
 
Share this answer
 
v2
Comments
Member 11970398 18-Nov-15 7:47am    
i am not using entity framework
Krunal Rohit 18-Nov-15 8:30am    
The first link within the answer doesn't use the EF.
But that doesn't matter at all. You can understand how it is done and code it yourself. :)

-KR
public ActionResult Registration(FormCollection obj_frmRegistration, HttpPostedFileBase upload)
{

Registration objc = newRegistration();
objc.AdminName = obj_frmRegistration["AdminName"];
objc.Gender = obj_frmRegistration["Gender"];
objc.typ= obj_frmRegistration["typ"];
objc.CompanyName = obj_frmRegistration["CompanyName"];
objc.img=obj_frmRegistration["CompanyName"];
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900