views:

51

answers:

1

i want a 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?

+2  A: 

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.

Serhat Özgel