Reputation: 2621
In ASP.NET MVC, to upload a file I simply use <input type="file" ... />
, and the action I post the form to takes an HttpPostedFileBase
as parameter. So far, so good. Now the question is: Does the HttpPostedFileBase
only contain metadata and reference a temporary file on the server's disk, or does the object contain the actual bytes? This is important because of scalability, since I have a scenario where it would be very convenient to keep the HttpPostedFileBase
in the session, but I'm afraid this might quickly fill up the server's memory if the object contains the actual bytes of the uploaded file.
Upvotes: 0
Views: 1140
Reputation: 151
It keeps the data in memory. If you are worried about scalability, you probably need to plan for a web farm and it wouldn't be good to have many large items in your session any how. So probably best to manage these yourself (with files or the database and store the filename/id in the session).
The decision really depends on how many and how large the files are and what you do with them (i.e. do you need them every request, or maybe need one file in some session 20 minutes from now).
Upvotes: 2