Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ajax/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Ajax.js和JQuery.js将多个文件发布为null_Jquery_Ajax_File_Null - Fatal编程技术网

使用Ajax.js和JQuery.js将多个文件发布为null

使用Ajax.js和JQuery.js将多个文件发布为null,jquery,ajax,file,null,Jquery,Ajax,File,Null,我想使用Ajax.BeginForm,它包含一个input type=“file”multiple。但若我将文件值发送给控制器,则该文件值为空。因为JQuery.js和Ajax.js一起使用。如果在此视图中删除Jquery,则文件值不为null @{ ViewBag.Title = "Home Page"; } <script src="~/Scripts/jquery-3.3.1.js"></script> <script src="~/Scripts/

我想使用Ajax.BeginForm,它包含一个
input type=“file”
multiple。但若我将文件值发送给控制器,则该文件值为空。因为JQuery.js和Ajax.js一起使用。如果在此视图中删除Jquery,则文件值不为null

@{
   ViewBag.Title = "Home Page";
}

<script src="~/Scripts/jquery-3.3.1.js"></script>

<script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>

@using (Ajax.BeginForm("Send", "Home",new AjaxOptions { UpdateTargetId="result",HttpMethod="POST",InsertionMode=InsertionMode.Replace},new {enctype="multipart/form-data" }))
{
    <input name="name"  />

    <input   id="files" name="pictures" type="file" multiple />
    <button type="submit"  >SEND</button>

}

<div id="result"></div>
@{
ViewBag.Title=“主页”;
}
@使用(Ajax.BeginForm(“Send”、“Home”、新的AjaxOptions{UpdateTargetId=“result”、HttpMethod=“POST”、InsertionMode=InsertionMode.Replace}、新的{enctype=“multipart/form data”}))
{
发送
}
//控制器

 [HttpPost]
    public PartialViewResult Send(string name,IEnumerable<HttpPostedFileBase> pictures)
    {

        //int sayi = resimler.Count();
        ViewBag.a = "abcsados";

        return PartialView("veriler",ViewBag.a);
    }
[HttpPost]
public PartialViewResult发送(字符串名称,IEnumerable图片)
{
//int sayi=resimler.Count();
ViewBag.a=“abcsados”;
返回PartialView(“veriler”,ViewBag.a);
}

不能使用AJAX上载文件。这是不受支持的。如果您想这样做,您可以使用一些文件上传插件,如或,或者如果客户端浏览器支持,则使用


您好,欢迎使用堆栈溢出,请不要共享代码图像,因为这没有帮助,请直接在此处添加代码。避免外部链接,或者只是创建一个代码段并在此处添加链接!我是在asp.net中编辑的?正确的