How do I get jQuery's Uploadify plugin to work with ASP.NET MVC?

前端 未结 6 1322
梦如初夏
梦如初夏 2020-12-04 09:37

I\'m in the process of trying to get the jQuery plugin, Uploadify, to work with ASP.NET MVC.

I\'ve got the plugin showing up fine with the following JavaScript snipp

6条回答
  •  遥遥无期
    2020-12-04 10:40

    public string Upload(HttpPostedFileBase FileData) {}
    

    is correct - the file uploaded by uploadify will get binded to FileData. No need to get into Request.Files to retrieve the file - which makes it harder to mock and test.

    If your action isn't firing at all (i.e. try debugging and see if a breakpoint within the method is hit), then your issue is most likely the 'script' value - are you running under a virtual directory? If so you'll need to put the name of the directory in front. Uploadify is using an absolute path.

    i.e. 'script: '/virtual_directory/Placement/Upload'

    right now uploadify is sending to http://localhost/Placement/Upload.

    also try using the route debugger (http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx) to check where your route is being mapped to.

提交回复
热议问题