2011-08-06 147 views
1

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");} 
      }); 

這是真實的文件是否轉移。

in Allcammand.aspx如何獲取文件?????

+1

[JQuery Ajax File Upload]的可能重複(http://stackoverflow.com/questions/2320069/jquery-ajax-file-upload) – Quentin

回答