how to allow a user to upload a spreadsheet in asp.net mvc
i want a开发者_如何学C user to have file picker and then choose a spreadsheet which will then be parsed by a controller action. are there any examples of how to do this?
This article shows how to add a file upload control on an asp.net mvc page:
http://www.hanselman.com/blog/ABackToBasicsCaseStudyImplementingHTTPFileUploadWithASPNETMVCIncludingTestsAndMocks.aspx
With this line, you get the file from request:
HttpPostedFile hpf = Request.Files[file] as HttpPostedFile;
After getting it, you can do whatever you want with it.
精彩评论