I've got a situation in my .Net application where I have a popup modal where the user will select a Word document and my process will save it to a repository under a different standardized name. To get the input file from the address bar:
HttpPostedFileBase fileContent = Request.Files[0];
Then the save:
fileContent.SaveAs(fullPath);
Unfortunately the SaveAs does not work, as when you get the Word Document from the Response object, it blanks it out when doing the SaveAs. So what I need to do is get the Word Document that the user selected, and save the contents of that Word Document to a Word Document with a different, standardized name. so what I have so far is
using (var documentReader = new StreamReader(fileContent.InputStream))
{
var readDoc = documentReader.ReadToEnd();
}
I know my readDoc variable contains the selected Word document contents, and it appears to do the ReadToEnd correctly, the problem now is, I need to be able to save those contents stored in readDoc to a different Word Document with a different name. Any ideas on how to go about this?