jqueryファイルアップローダー(blueimpごと)を使用していますが、index.cshtml以外の特定のhttpポストバックにポストバックを送信する方法を知りたいですか(ポストはデフォルトでindex.cshtmlに送信されます)?
たとえば、Home / Bulkを呼び出すと、ファイルを選択した後、ポストバックはデフォルトで[httppost] index.cshtml()になります... [httppost] bullk.cshtml()に転送するにはどうすればよいですか?どうも!
ビュー(Bulk.cshtml):
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="@Url.Content("~/Scripts/jquery.ui.widget.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.iframe-transport.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.fileupload.js")" type="text/javascript"></script>
@using (Html.BeginForm("Bulk", "Home")) // I want this to direct back to httppost:bulk handler
{
<input id="fileupload" type="file" name="files" multiple="multiple"/>
}
コントローラ:
public class HomeController : Controller
{
public ActionResult Index()
{
return View();
}
[HttpPost]
public ActionResult Index(IEnumerable<HttpPostedFileBase> files)
{
foreach (var file in files)
{
var filename = Path.Combine(Server.MapPath("~/App_Data"), file.FileName);
file.SaveAs(filename);
}
return View();
}
public ActionResult Bulk()
{
return View();
}
[HttpPost]
public ActionResult Bulk(IEnumerable<HttpPostedFileBase> files)
{
foreach (var file in files)
{
var filename = Path.Combine(Server.MapPath("~/App_Data"), file.FileName);
file.SaveAs(filename);
}
return View();
}
}