Source: http://www.cnblogs.com/zmgdpg/archive/2005/03/31/129758.html
Effect:
Database:
Ideas:
First, save the word to the database: Get the size of the byte of the uploaded file, then read the byte from the stream, and then save the obtained stream to the database.
Read Database: Find the stream data in the database by name, and then use the reader BinaryWriter to read the stream file and save it to the specified directory.
Code:
Page_Load( btn_Click( name = Stream fileStream = length = [] wordData = fileStream.Read(wordData, DateTime time = SqlConnection conn = conn.ConnectionString = ConfigurationManager.ConnectionStrings[ SqlCommand cmd = cmd.Connection = cmd.CommandText = SqlParameter nameParam = SqlParameter(, System.Data.SqlDbType.VarChar, nameParam.Value = SqlParameter timeParam = SqlParameter(, System.Data.SqlDbType.DateTime, timeParam.Value = SqlParameter contentParam = SqlParameter( contentParam.Value = i = (i > Response.Write( Response.Write( btn1_Click( SqlConnection conn = conn.ConnectionString = ConfigurationManager.ConnectionStrings[ SqlCommand cmd = cmd.Connection = cmd.CommandText = + tb1.Text.ToString() + buffersize = [] outbyte = filePath = + tb1.Text + reader = fs = bw = startIndex = reval = reader.GetBytes(, startIndex, outbyte, (reval == startIndex += reval = reader.GetBytes(, startIndex, outbyte, bw.Write(outbyte, , ()reval - (reader.Read().ToString() != Response.Write( + tb1.Text + Response.Write( }