Commit 7e83236 郑小波
committed
1 parent ccce4b3 commit 7e83236 Copy full SHA for 7e83236
File tree 2 files changed +7
-4
lines changed
2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -73,6 +73,11 @@ export default function upload(option) {
73
73
option . onSuccess ( getBody ( xhr ) , xhr ) ;
74
74
} ;
75
75
76
+ option . method = option . method || 'POST' ;
77
+ xhr . open ( option . method , option . action , true ) ;
78
+
79
+ // In Internet Explorer, the timeout property may be set only after calling the open() method and before calling the send() method.
80
+ // see https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/timeout
76
81
const { timeout } = option ;
77
82
78
83
if ( typeof timeout === 'number' && timeout > 0 ) {
@@ -83,9 +88,6 @@ export default function upload(option) {
83
88
} ;
84
89
}
85
90
86
- option . method = option . method || 'POST' ;
87
- xhr . open ( option . method , option . action , true ) ;
88
-
89
91
// Has to be after `.open()`. See https://github.com/enyo/dropzone/issues/179
90
92
if ( option . withCredentials && 'withCredentials' in xhr ) {
91
93
xhr . withCredentials = true ;
Original file line number Diff line number Diff line change @@ -81,8 +81,9 @@ export default class Selecter extends React.Component {
81
81
if ( ! el ) {
82
82
return ;
83
83
}
84
- el . click ( ) ;
84
+ // NOTE: 在 IE 下, el.value = '' 在 el. click() 之后,会触发 input[type=file] 两次 onChange
85
85
el . value = '' ;
86
+ el . click ( ) ;
86
87
} ;
87
88
88
89
/**
You can’t perform that action at this time.
0 commit comments