diff --git a/components/upload/Upload.tsx b/components/upload/Upload.tsx index 0efcce6a31..eed2132a05 100644 --- a/components/upload/Upload.tsx +++ b/components/upload/Upload.tsx @@ -103,7 +103,7 @@ class Upload extends React.Component { } }; - onSuccess = (response: any, file: UploadFile) => { + onSuccess = (response: any, file: UploadFile, xhr: any) => { this.clearProgressTimer(); try { if (typeof response === 'string') { @@ -120,6 +120,7 @@ class Upload extends React.Component { } targetItem.status = 'done'; targetItem.response = response; + targetItem.xhr = xhr; this.onChange({ file: { ...targetItem }, fileList, diff --git a/components/upload/index.en-US.md b/components/upload/index.en-US.md index 2ead236f36..ba49919508 100644 --- a/components/upload/index.en-US.md +++ b/components/upload/index.en-US.md @@ -62,10 +62,11 @@ When uploading state change, it returns: ```js { uid: 'uid', // unique identifier, negative is recommend, to prevent interference with internal generated id - name: 'xx.png' // file name + name: 'xx.png', // file name status: 'done', // options:uploading, done, error, removed response: '{"status": "success"}', // response from server linkProps: '{"download": "image"}', // additional html props of file link + xhr: 'XMLHttpRequest{ ... }', // XMLHttpRequest Header } ``` diff --git a/components/upload/interface.tsx b/components/upload/interface.tsx index a2c11fbb95..b063f406c0 100755 --- a/components/upload/interface.tsx +++ b/components/upload/interface.tsx @@ -40,6 +40,7 @@ export interface UploadFile { error?: any; linkProps?: any; type: string; + xhr?: T; } export interface UploadChangeParam {