FileRequestFileBytes Property |
Namespace: Aceoffix
If you want to save the file to the data field of a database, you should call this FileBytes property. If you want to save the file to disk, you only need to call SaveToFile(String).
![]() |
---|
The maximum size allowed for a request, which includes uploaded files, is 4 MB, by default. Maximum request size can be specified in the Machine.config or Web.config file in the maxRequestLength attribute of the httpRuntime Element (ASP.NET Settings Schema) element. The maximum request size for a specific page can be specified using the location Element (ASP.NET Settings Schema) element in a Web.config file. |
protected void Page_Load(object sender, EventArgs e) { string strID = Request.QueryString["id"]; if(strID == null) return; Aceoffix.FileRequest freq = new Aceoffix.FileRequest(); string connstring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|demo.mdb"; OleDbConnection conn = new OleDbConnection(connstring); conn.Open(); OleDbCommand cmd = new OleDbCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = "update documents set FileBin = @file where ID = @id"; OleDbParameter spFile = new OleDbParameter("@file",OleDbType.Binary); spFile.Value = freq.FileBytes; cmd.Parameters.Add(spFile); OleDbParameter spID = new OleDbParameter("@id",OleDbType.Integer); spID.Value = strID; cmd.Parameters.Add(spID); cmd.ExecuteNonQuery(); conn.Close(); freq.Close(); }