File tree Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Expand file tree Collapse file tree 1 file changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -232,27 +232,30 @@ $.fn.ajaxSubmit = function(options) {
232
232
cache : false ,
233
233
type : 'POST'
234
234
} ) ;
235
-
235
+
236
236
if ( options . uploadProgress ) {
237
237
// workaround because jqXHR does not expose upload property
238
238
s . xhr = function ( ) {
239
239
var xhr = jQuery . ajaxSettings . xhr ( ) ;
240
240
if ( xhr . upload ) {
241
241
xhr . upload . onprogress = function ( event ) {
242
242
var percent = 0 ;
243
- if ( event . lengthComputable )
244
- percent = parseInt ( ( event . position / event . total ) * 100 , 10 ) ;
245
- options . uploadProgress ( event , event . position , event . total , percent ) ;
246
- } ;
243
+ var position = event . loaded || event . position ; /*event.position is deprecated*/
244
+ var total = event . total ;
245
+ if ( event . lengthComputable ) {
246
+ percent = Math . ceil ( position / total * 100 ) ;
247
+ }
248
+ options . uploadProgress ( event , position , total , percent ) ;
249
+ }
247
250
}
248
251
return xhr ;
249
- } ;
252
+ }
250
253
}
251
254
252
- s . data = null ;
253
- var beforeSend = s . beforeSend ;
254
- s . beforeSend = function ( xhr , o ) {
255
- o . data = formdata ;
255
+ s . data = null ;
256
+ var beforeSend = s . beforeSend ;
257
+ s . beforeSend = function ( xhr , o ) {
258
+ o . data = formdata ;
256
259
if ( beforeSend )
257
260
beforeSend . call ( o , xhr , options ) ;
258
261
} ;
You can’t perform that action at this time.
0 commit comments