public AtService(Attachment attachment, int questionId, int answerId) { this._attachment = attachment; this._questionId = questionId; this._answerId = answerId; }
protected void Button1_Click(object sender, EventArgs e) { string fielname = FileUpload1.FileName; Stream fs = FileUpload1.PostedFile.InputStream; byte[] arr = new byte[fs.Length]; fs.Read(arr, 0, arr.Length); Attachment atc = new Attachment { FileName = fielname, ImgArr = arr, Title = "alt" }; AtService service = new AtService(atc, 0, 0); service.Save(); Response.Write("uplaod suc."); }