MVC: when is a file uploaded?

43 Views Asked by At

When uploading files to a server and calling a controller method does a HttpPostedFileBase contain the entire file or just information such as name, path, etc?

What I want to know is if the file is uploaded to the server right away or not until calling SaveAs(path) ?

1

There are 1 best solutions below

2
artragis On BEST ANSWER

As the file is part of your request, it is uploaded immediatly. It is just buffered into a tempfile which the system will delete once you send the Response.

If you use SaveAs, you just transfert the file into a permanent location.