jquery 파일 업 로더 (blueimp 당)를 사용하고 있는데 어떻게 index.cshtml 이외의 특정 http 포스트 백으로 포스트 백을 보낼 수 있는지 궁금합니다 (포스트는 index.cshtml을 기본값으로 사용하고 있습니다)?jquery 파일 가져 오기 방법 [httpPost] index.cshtml() 이외의 지정된 작업을 다시 게시 하시겠습니까?
예를 들어 Home/Bulk ...를 호출 할 때 파일을 선택한 후 포스트 백이 기본값 [httppost] index.cshtml() ... [httppost] bulk.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();
}
}
네, 훌륭했습니다. 방금 url : url : @@ Url.Action ("Bulk", "Home") '을 추가하여 올바른 URL을 생성했습니다. 고마워! – JaJ