cainiaoyangchengji
js
 function UpladFile() {



        var fileObj = document.getElementById("filetes").files[0]; // 获取文件对象

        var FileController = "/Home/upfile";                    // 接收上传文件的后台地址 



        // FormData 对象

        var form = new FormData();

        form.append("author", "hooyes");                        // 可以增加表单数据

        form.append("file", fileObj);                           // 文件对象



        // XMLHttpRequest 对象

        var xhr = new XMLHttpRequest();

        xhr.open("post", FileController, true);

        xhr.onload = function () {

            alert("上传完成!");

        };

        xhr.send(form);



    }
后台
var flist = Request.Files;



            for (int i = 0; i < flist.Count; i++)

            {

                string FilePath = "D:";

                var c = flist[i];

                FilePath = Path.Combine(FilePath, c.FileName);

                c.SaveAs(FilePath);

            }

  

分类:

技术点:

相关文章:

  • 2021-09-29
  • 2021-09-08
  • 2021-09-25
  • 2021-12-13
  • 2021-12-13
  • 2021-12-13
  • 2018-06-14
猜你喜欢
  • 2021-11-17
  • 2021-09-29
  • 2021-09-29
  • 2021-11-27
  • 2021-11-27
  • 2021-11-17
  • 2021-11-27
相关资源
相似解决方案