How can I check if the browser support HTML5 file upload (FormData object)?

后端 未结 7 1929
离开以前
离开以前 2020-12-08 04:38

How can I check if the browser support HTML5 file upload (FormData object)?

var fd = new FormData();

Following the answer from this post, b

7条回答
  •  一向
    一向 (楼主)
    2020-12-08 05:27

    This is the one-liner I use to check if the browser supports FormData and upload progress, in jQuery:

     var xhr2 = !! ( window.FormData && ("upload" in ($.ajaxSettings.xhr()) );
    

提交回复
热议问题