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