Click or drag to resize
FileRequestFileBytes Property
Returns an array of the bytes in the file submitted by AceoffixCtrl.

Namespace: Aceoffix
Assembly: Aceoffix (in Aceoffix.dll) Version: 5.0.0.1
Syntax
public byte[] FileBytes { get; }

Property Value

Type: Byte
A Byte array that contains the contents of the file.
Remarks

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).

Note Note
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.
Examples
The following code example demonstrates how to save the document submitted by AceoffixCtrl to the data field of a database. This code must be written in the server page specified by SaveFilePage.
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();
}
See Also