I have to start the user uploading large files to a web browser, where I create a file for transfer on the server and then delete it immediately after that. I found enough examples to see that I should probably use Response.TransmitFile or Response.WriteFile ... but heard that there are problems with both:
WriteFile is synchronous, but it loads the file into memory before sending it to the user. Since I am dealing with very large files, this can cause problems.
TransmitFile does not load locally, so it works for large files, but it is asynchronous, so I cannot delete the file after calling TransmitFile. Obviously flushing the file does not guarantee that I can delete it?
What is the best way to handle this?
There is also BinaryWrite ... Can I skip a file stream by copying it in segments?
source
share