如何使用多部分/表单数据进行 ASP.NET MVC Ajax 表单发布? [英] How to do a ASP.NET MVC Ajax form post with multipart/form-data?

查看:33
本文介绍了如何使用多部分/表单数据进行 ASP.NET MVC Ajax 表单发布?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 ASP.NET MVC 网站,该网站有一个允许使用表单标签上的 multipart/form data enctype 选项上传文件的表单

I am working on a ASP.NET MVC web site which has a form that allows for the upload of files using the multipart/form data enctype option on the form tag like so

<form enctype="multipart/form-data" method="post" action='<%= Url.Action("Post","Entries",new {id=ViewData.Model.MemberDetermination.DeterminationMemberID})  %>'>

我将如何编写此代码来代替 ASP.NET MVC Ajax 表单发布?

How would I write this to do an ASP.NET MVC Ajax form post instead?

推荐答案

  1. 您可以使用一些额外的上传器(例如 jQuery 多文件上传器)(我更喜欢这种方式,我更喜欢不使用 MS Ajax)
  2. 使用:

  1. You can use some additional uploaders (e.g. jQuery multiple file uploader) (I prefer this way and I prefer not to use MS Ajax)
  2. Use:

AjaxHelper.BeginForm("Post", "Entries", new {id=ViewData.Model.MemberDetermination.DeterminationMemberID}, new AjaxOptions(){/*some options*/}, new {enctype="multipart/form-data"})

但在第二种情况下,我不确定它会起作用.

But in second case I'm not sure that it will work.

这篇关于如何使用多部分/表单数据进行 ASP.NET MVC Ajax 表单发布?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆