FileUpload轉換為字節
//FileStream _fs = new FileStream(this.FileUpload1.FileName, FileMode.Open);
byte[] iBytes = new byte[this.FileUpload1.FileContent.Length];
BinaryReader _br = new BinaryReader(this.FileUpload1.FileContent);
iBytes = _br.ReadBytes(Convert.ToInt32(this.FileUpload1.FileContent.Length));
//_fs.Close();
string T_number = DateTime.Now.ToString().Replace("/", "").Replace(":", "").Replace(" ", "").Replace("-", "").Replace(".", "");
string T_message = this.TextBox1.Text.ToString().Trim();
DateTime T_releasetime = DateTime.Now;
if(_db.CreateReleases(T_number, T_message, iBytes, "NULL", T_releasetime))
{
Response.Redirect("~/", true);
}
else
{
Response.Write("<script type=‘text/javascript‘>alert(‘創建信息過程出錯,請重試!‘);</script>");
return;
}
FileUpload轉換為字節