In my site, User uploads some file from his system and sends email.
try
{
  if(Request.Files!=null)
  {
     //save the file to some temp location 
     //Attach the file to email & send
  }
}
catch(Exception ex)
{
  //log exception
}
finally
{
    //delete the file from temp location
    System.IO.File.Delete(attachmentLocation);
}
But if email sendings fails, then I am able to delete the file but in case email is sent successfully,then I get an exception
The file test.pdf cannot be deleted, as its used by another process
Is it possible to attach the file without saving it? 
 
In case not, then how I do delete the file after sending email? 
FYI:- This is an AJAX call.