1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| protected void btnUpload_Click(object sender, EventArgs e)
{
if (fileUpload.HasFile)
{
int contentLength = fileUpload.PostedFile.ContentLength;
string contentType = fileUpload.PostedFile.ContentType;
string fileName = fileUpload.PostedFile.FileName;
bool bUpload = true;
byte[] contentbyte = new byte[contentLength];
fileUpload.PostedFile.InputStream.Read(contentbyte, 0, contentLength);
int idAgir = Convert.ToInt32(hdnIdAgir.Value);
int idAttachment = DAOAttachment.Insert(fileName, contentLength, contentType, contentbyte, bUpload);
DAOAgir_Attachment.Insert(idAgir, idAttachment);
RefreshgvAttachment(idAgir);
if (OkClick != null)
OkClick(this, null);
}
} |
Partager