work with images in sql server + Asp net

Asked

Viewed 36 times

0

Guys, in my project I need to work with uploading images through the site Asp.net and save them in sql server, and then I need to show them on a page as if it were products, with description and etc. In sql I save the field with type "image" right? but in the model of the project, what kind I put?

1 answer

0


Good afternoon!! I have worked with situations like this and after a good search and considerations, I have as an idea that you just save the image address in the database and save the images in a folder on the server. This is a good practice adopted where various points are taken, such as performance. Only in very specific cases is it recommended to store images directly in the database.

Now, if your case is really saving in the database, to save an image you can use the sql blob field and in c# you will use an array of bytes.

Follow a link for you to take a look.

https://www.c-sharpcorner.com/article/how-should-we-store-images-and-blob-files-in-sql-server/

I hope I’ve helped!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.