views:

551

answers:

2

Hello

I want to upload files from fileupload control and save them as varbinary Filestream in the database.

First of all, does this make sense? Would you recommend this?

Then, how does it work? I want to be able to upload Imagefiles as well as .doc and .xls.

so when i have uploaded a .xls, how would i save it to the Database(i'm going to use Linq2Entities).

Thanks for help

+2  A: 

Sure that makes sense. This link goes through that method.

http://www.kodyaz.com/articles/file-upload-and-save-to-sql-server.aspx

Albert
Thank you, thats what i needed.I just saved a .doc into the database. How can i output it?with Response.contentype it should work somehow, but im not sure how.
k0ni
And how would i save a file with LinqToEntities?when i try to save it i get an error telling me:Unable to update the EntitySet 'tbl_Files' because it has a DefiningQuery and no <InsertFunction> element exists in the <ModificationFunctionMapping> element to support the current operation.
k0ni
A: 

I suggest save file on disc and filename (additional data like size, mimetype, etc) in database.

dario-g