title: How can I upload a file using AsyncFileUpload and save the bytes in database?
body: <p>I'm using <code>radAsyncFileUpload</code> to upload a file. I want to save the file contents in a database as bytes. Here's my code so far:</p>
  
  <pre><code>protected void DetailsView1_ItemInserting(object sender, DetailsViewInsertEventArgs e)
  {
      if (DetailsView1.CurrentMode == DetailsViewMode.Insert)
      {
          if (Session["ProjectId"] != null)
          {
              int Projectid = Convert.ToInt32(Session["ProjectId"]);
              string Description = (DetailsView1.FindControl("RadEditor1") as RadEditor).Content;
              RadAsyncUpload radAsyncUpload = DetailsView1.FindControl("RadAsyncUpload1") as RadAsyncUpload;
  
              UploadedFile file = radAsyncUpload.UploadedFiles[0];
              string s = file.FileName;
              string path = System.IO.Path.GetFileName(s);
  
              radAsyncUpload.UploadedFiles[0].SaveAs(Server.MapPath("Uploads/") + path);
              string Contenttype = radAsyncUpload.UploadedFiles[0].ContentType;
              int fileSize = radAsyncUpload.UploadedFiles[0].ContentLength;
              float length = float.Parse(fileSize.ToString());
              byte[] fileData = new byte[file.InputStream.Length];
              file.InputStream.Read(fileData, 0, (int)file.InputStream.Length);
  
  
                      ProTrakEntities objEntity = new ProTrakEntities();
                      ProjectFile objFile = new ProjectFile();
                      objFile.ProjectId = Projectid;
                      objFile.FileName = s;
                      objFile.FileType = Contenttype;
                      objFile.FileSize = length;
                      objFile.CreatedBy = "admin";
                      objFile.CreatedDate = DateTime.Now;
                      objFile.Description = Description;
                      objFile.FileData = fileData;
                      objEntity.AddToProjectFiles(objFile);
                      objEntity.SaveChanges();
  
          }
          DetailsView1.ChangeMode(DetailsViewMode.ReadOnly);
          ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind('navigateToInserted');", true);
  
  
  
      }
  }
  </code></pre>
  
  <p>I'm getting an error while uploading at the line <code>file.InputStream.Read(fileData, 0, (int)file.InputStream.Length);</code>:</p>
  
  <blockquote>
    <p><code>Could not find file 'D:\Tiru\Projects\ProTrak\App_Data\RadUploadTemp\0ngsv0wx.fxs'.</code></p>
  </blockquote>
  
  <p>What does this error mean, and how can I get rid of it?</p>