How to store the file which is uploaded by the user to the database ? I want to store the file in the database how can we do that ? In the back-end I am using sql with c#.net application.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This solution works for SQL SERVER 2005/2008.
You have to create table with
VARBINARY(MAX)as one of the columns. In my case I’ve created TableRaportywith columnRaportPlikbeingVARBINARY(MAX)column.Below there are couple of support functions you can modify for your needs:
First method is to put file into database from drive, second method is to get file and save it on drive, and 3rd method is to get file from database and put it as
MemoryStreamso you can some other stuff with it then just writing it to drive.This 4th method is to put
MemoryStreaminto database: