File tree Expand file tree Collapse file tree 2 files changed +36
-10
lines changed
Expand file tree Collapse file tree 2 files changed +36
-10
lines changed Original file line number Diff line number Diff line change 129129 if ( file . blob && file . blob . toBlob ) {
130130 queue . inc ( ) ;
131131 _convertFile ( file , function ( file , blob ) {
132- data . append ( file . name , blob , file . file ) ;
132+ try {
133+ // FromData#append throws exception in IE10-11,
134+ // when a file size is larger than 4GB
135+ data . append ( file . name , blob , file . file ) ;
136+ } catch ( err1 ) {
137+ data . _error = err1 ;
138+ }
139+
133140 queue . next ( ) ;
134141 } ) ;
135142 }
136- else if ( file . file ) {
137- data . append ( file . name , file . blob , file . file ) ;
138- }
139- else {
140- data . append ( file . name , file . blob ) ;
143+ else {
144+ try {
145+ if ( file . file ) {
146+ data . append ( file . name , file . blob , file . file ) ;
147+ }
148+ else {
149+ data . append ( file . name , file . blob ) ;
150+ }
151+ }
152+ catch ( err2 ) {
153+ data . _error = err2 ;
154+ }
141155 }
142156
143157 if ( file . file ) {
144- data . append ( '_' + file . name , file . file ) ;
158+ try {
159+ data . append ( '_' + file . name , file . file ) ;
160+ }
161+ catch ( err3 ) {
162+ data . _error = err3 ;
163+ }
145164 }
146165 } ) ;
147166 } ,
Original file line number Diff line number Diff line change 7171 var _this = this , options = this . options ;
7272
7373 FormData . toData ( function ( data ) {
74- // Start uploading
75- options . upload ( options , _this ) ;
76- _this . _send . call ( _this , options , data ) ;
74+
75+ if ( data . _error ) {
76+ _this . end ( 0 , data . _error . message ) ;
77+ }
78+ else {
79+ // Start uploading
80+ options . upload ( options , _this ) ;
81+ _this . _send . call ( _this , options , data ) ;
82+ }
83+
7784 } , options ) ;
7885 } ,
7986
You can’t perform that action at this time.
0 commit comments