How to save an uploaded file directly to a database?
With Ajax Uploader, you can now upload files directly to a database with practically a few lines of code. And the following two easy-to-follow steps show you exactly how to do it.
1. Store the content of the uploaded file in the Byte buffer.
void Uploader_FileUploaded(object sender, UploaderEventArgs args)
{
byte[] data = new byte[args.FileSize];
using (Stream stream = args.OpenStream())
{
stream.Read(data, 0, data.Length);
}
}
2. Store the buffer in the Database, and it is very easy as long as you have the database table and you know some SQL Statments.