File Attachment error

He Team
my code id given blow . my file is upload in issue but when we download that file there is no content . empty file .but file size is showing

public void AddAttachments(string issueKey)  
{  
    string restUrl = String.Format("{0}rest/api/2/issue/{1}/attachments", Url, issueKey);  
    List<JiraFile> lstStream = new List<JiraFile>();  
    if (FileUpload1.HasFile)  
    {   
        lstStream.Add(new JiraFile() { FileName = FileUpload1.FileName, Stream = FileUpload1.PostedFile.InputStream });  
    }  
    if (FileUpload2.HasFile) {   
        lstStream.Add(new JiraFile() { FileName = FileUpload2.FileName, Stream = FileUpload2.PostedFile.InputStream });  
    }  
    if (lstStream.Count > 0)  
    {  
        PostFile(restUrl, lstStream);  
    }  
}  

private void PostFile(string restUrl, List<JiraFile> lstStream)  
{  
    HttpWebResponse response = null;  
    HttpWebRequest request = null;  
    String boundary = String.Format("----------{0:N}", Guid.NewGuid());  
    var stream = new MemoryStream();  
    var writer = new StreamWriter(stream);  
    foreach (var file in lstStream)  
    {  
        var data = new byte[file.Stream.Length];  
        file.Stream.Read(data, 0, data.Length);  
        file.Stream.Close();  
        writer.WriteLine("--{0}", boundary);  
        writer.WriteLine("Content-Disposition: form-data; name=\"file\"; filename=\"{0}\"", file.FileName);  
        writer.WriteLine("Content-Type: application/octet-stream");  
        writer.WriteLine();  
        writer.Flush();  
        stream.Write(data, 0, data.Length);  
        writer.WriteLine();  
    }  
         
    writer.WriteLine("--" + boundary + "--");  
    writer.Flush();  
    stream.Seek(0, SeekOrigin.Begin);  
    request = WebRequest.Create(restUrl) as HttpWebRequest;  
    request.Method = "POST";  
    request.ContentType = string.Format("multipart/form-data; boundary={0}", boundary);  
    request.Accept = "application/json";  
    request.Headers.Add("Authorization", "Basic " + Utility.GetEncodedCredentials(UserName, Password));  
    request.Headers.Add("X-Atlassian-Token", "nocheck");  
    request.ContentLength = stream.Length;  
    using (Stream requestStream = request.GetRequestStream())  
    {  
        stream.WriteTo(requestStream);  
        requestStream.Close();  
    }  
    using (response = request.GetResponse() as HttpWebResponse)  
    {  
        if (response.StatusCode != HttpStatusCode.OK)  
        {  
            var reader = new StreamReader(response.GetResponseStream());  
            Console.WriteLine("The server returned '{0}'\n{1}", response.StatusCode, reader.ReadToEnd());  
        }  
    }  
    request.Abort();  
  
}