You need to declare an image type of a variable may be called a img, image img = new image ();, then create a entities object, Entities X = new XXEntities (). ASP. net WebAdd page FileUpload control, the control provides a property Posted File can Servers Provide an input output stream, you can just select a picture for us to read the server's Memory, The code is as follows:
Code:
System.IO.Stream stream = FileUpload123.PostedFile.InputStream;
byte [] buffer = new byte [stream.Length];
stream.Read (buffer, 0, (int) stream.Length);
stream.Close ();
img123.imagefile123 = buffer;
The next step is to represent images of the byte array deposited in the database, the code is as follows:
Code:
123.AddToimageSet (t);
123.SaveChanges ();
This picture into the database operation is complete.
Bookmarks