× {{alert.msg}} Never ask again
Get notified about new tutorials RECEIVE NEW TUTORIALS

MemoryStream: local or not?

James Jensen
Feb 10, 2015
<p>MemoryStream holds the data in your system's memory (RAM). So it will be on whatever computer the code is running on.</p> <p>In this case, it appears that you're saying your server-side code is using a MemoryStream to hold the data that comes in from a form POST. Typically it's better to save the file to a temporary location on the disk, rather than trying to hold the entire file in memory. </p> <p>Or, if you're expecting to accept really large files, and you don't need to do any intermediate processing, you could just do a pass-through stream straight up to s3. The danger in this is that if the upload fails to complete, it'll probably take a little more effort to ensure things are cleaned up properly.</p> <p>This tip was originally posted on <a href="http://stackoverflow.com/questions/22668383/MemoryStream:%20local%20or%20not?/22668428">Stack Overflow</a>.</p>
comments powered by Disqus