开发者

send file to server

开发者 https://www.devze.com 2023-03-26 14:04 出处:网络
HTML <input type=\"file\" id=\"file1\" /> SCRIPT file=$(\"#file1\"); $.ajax({ 开发者_运维百科type: \"POST\",

HTML

<input type="file" id="file1" />

SCRIPT

file=$("#file1");

            $.ajax({
  开发者_运维百科           type: "POST",
             url: "Allcammand.aspx?cmd=EnterProduct&idCompany="+getParam("idCompany"),
             type:"post",
             data: {
                 file: file
              },
                async: false ,
                   success: function(response){                                                                   
                    },
                    error:function(xhr, ajaxOptions, thrownError){alert(xhr.responseText); ShowMessage("خطا در انتقال اطلاعات شرکت","fail");}
            });

This is true whether the file transfer.

in Allcammand.aspx how can get file?????


Uploading files via AJAX is a complex process that you probably aren't going to want to write yourself. I'd recommend using something like this: http://jquery.malsup.com/form/

0

精彩评论

暂无评论...
验证码 换一张
取 消