Home > ASP.NET > How to upload file and save Image in Binary format in SQL server



How to upload file and save Image in Binary format in SQL server

In this article, we have described how to upload file and save image in Binary format in SQL server using C# with an example and a sample code.


In this article, we have described how to upload file and save image in Binary format in SQL server using C# with an example and a sample code. In this example, we have taken a FileUpload control and submit button. After clicking on the button, the image is saved in the binary format into the database and the display will be the image on Image control.

 

DataBase

We have provided the database table structure below. You can see it below and refer.

Upload file and Save Image in binary format in SQL Server

 

Table Script

Refer the table script for your references.

 

Required Namespaces

you will need to use the following namespaces.

 

HTML

In the html we are using FileUplaod control and Image control for this activity.

 

C#

We are storing the data in byte[] using BinaryReader

 

Screenshot

Upload file and Save Image in binary format in SQL Server

 

Download




Note: All contents are copyright of their authors.



Comments



Leave a Reply

Comment:*
Email ID:*


Name:*