2011-08-06 10 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");} 
      }); 

これが真でファイル転送するかどうか。

Allcammand.aspxどのようにファイルを取得できますか????

+1

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

答えて

1

AJAXを介してファイルをアップロードすることは、おそらくあなた自身を書きたくない複雑なプロセスです。私はこのようなものを使用することをお勧めします:http://jquery.malsup.com/form/