ajaxSubmit post 文件

Posted boytomato

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ajaxSubmit post 文件相关的知识,希望对你有一定的参考价值。

     $(function () {

            var wait = $("<img src=\"\" alt=\"正在上传\"/>");
            $("#File1").change(function () {

                $("#form1").ajaxSubmit({
                    url: ‘/Provider/HandlerUpOneFile.ashx?path=1‘,
                    beforeSubmit: function () {

                    },
                    success: function (data) {
                        $("#File1").attr("src", data);
                        // alert( $("#File1").attr("src"));
                        alert(data);

                    }
                });
            });
        });

 

      <form id="form1" method="post" enctype="multipart/form-data" >
          <div class="easyui-panel" style="padding:10px;"> 选择文件 
      
               <input  type="file" id="File1" name="File1" /> 注意此处 name 必须设置否则无法获取
          
              <a class="easyui-linkbutton" data-options="iconCls:‘icon-ok‘" href="javascript:void(0)" onclick="LoadData()">上传文件</a>

</div></form>

 

以上是关于ajaxSubmit post 文件的主要内容,如果未能解决你的问题,请参考以下文章