14
I have a t2.micro instance on Amazon where I use IIS 10 as server and webforms in the application (C#).
In a certain part of the application, I need to grab a list of image files from a certain folder, zip it and reply as download to the user.
The problem is that in a particular case, when the ZIP file has reached 1GB, the server simply hangs when the user clicks on the button to download that ZIP file.
I would like to ask some questions, not regarding the above problem, but a technical question regarding how download responses work, when you write it through a Stream or something like.
For the server, there is some difference between writing a response from a file directly and writing using buffer (using a while
, for example)?
Example 1 - Directly:
// headers para download
readfile($filename);
Example 2 - By Buffer:
// headers para download
$handler = fopen($filename);
while(feof($handler) !== false) {
echo fgets($handler, 4096);
}
Thank you downvoter, I would like a feedback
– Wallace Maxters