I want to know two things about ASP.NET MVC2 that I’ve researched from Google but still confusing. Hope I can find clear and clean answer here.
First, how to upload a file to server with custom file path. (Eg. to /Content/Files)
Second, how to download that file, since the url has applied URL Rounting, how to map to them?
Thanks for your answers!
To upload, you’ll use something like this.
And here’s the code on the controller to save the file:
As for downloading, say you have the directory “~/Content/Files”…
You just have to exclude them in your route.