user1400915
user1400915

Reputation: 1943

Equivalent of Controller.Read() in ASP.NET MVC 3

I want to send the files in filestreams of size more than 800 MB from controller to UI.

Is there any method to send the filestream from controller to browser in chunks.

because if I use

File(downloadStream, "application/octet-stream", fileName);

is taking system memory and not able to send it to UI.

Please suggest the most efficient way of sending the filestream in chunks .

Upvotes: 0

Views: 121

Answers (1)

Anand
Anand

Reputation: 14945

Use FilePathResult, which uses HttpResponse.TransmitFile to write the file directly to the http. This method doesn't buffer the file in memory on the server, so it should be a better option for sending larger files.

Check out its implementation here

Upvotes: 1

Related Questions