Handling 2 buttons submit Actions in a single View/Form - ASP.NET MVC 2 RTM

前端 未结 3 1365
感动是毒
感动是毒 2021-01-06 17:47

I have a View in which the user is able to upload a file to the server.

In this view I also have 2 buttons: one to Upload a file and other to Download the last file

3条回答
  •  -上瘾入骨i
    2021-01-06 18:02

    To generate a POST request for the upload, use the File Input form element and just post back to the server ala normal.

    http://www.w3schools.com/jsref/dom_obj_fileupload.asp

    Have a look at this blog post from Scott Hanselman. http://www.hanselman.com/blog/ABackToBasicsCaseStudyImplementingHTTPFileUploadWithASPNETMVCIncludingTestsAndMocks.aspx

提交回复
热议问题