Create & Download file runtime in MVC
-
I have a grid with empid's now if a person selects 2 grid by selecting checkboxes and click on download button 2 files should be offered to download. I know that we can create a file and can send the location of the physical file. But is there a way i can stream the files Download button click is via ajax.
-
I have a grid with empid's now if a person selects 2 grid by selecting checkboxes and click on download button 2 files should be offered to download. I know that we can create a file and can send the location of the physical file. But is there a way i can stream the files Download button click is via ajax.
Yep,
public ActionResult GetFile()
{
var theStream = new Memorystream();
// create your file and add to memorystream or open a filestream instead.
return new FileStreamResult(theStream, string appropriateContentType);
}