Hello, would anyone please give me example/s on how to make an ASP.NET 2.0 c# script that would upload a file but saves it instead into an mssql database? thanks
You'll need to a HTMLInputFile control, and then access the PostedFile object that it reveals. The trouble is though that the PostedFile.FileContent attribute is not anything like a byte array - it is actually a stream! The way I did it was to write that stream out to a file in memory (using MemoryStream), then read that back in like you do as any other stream to get the bytes out. Once you have the bytes, you can then store the data directly into a blob in the database. You may want to store some other information in there too, such as mimetype.