Skip to content

Commit f5a38c5

Browse files
committed
c
1 parent 8088d16 commit f5a38c5

File tree

3 files changed

+16
-5
lines changed

3 files changed

+16
-5
lines changed

src/flow/flow.js

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@
3232
* Supported by browser?
3333
* @type {boolean}
3434
*/
35+
36+
// ie10 +
37+
// ie 不能通过formdata上传0kb的文件
38+
// 所以还是采用传统的方式
39+
var ie10 = window.navigator.msPointerEnabled;
40+
3541
this.support = (
3642
typeof File !== 'undefined' &&
3743
typeof Blob !== 'undefined' &&
@@ -40,8 +46,10 @@
4046
!!Blob.prototype.slice || !!Blob.prototype.webkitSlice || !!Blob.prototype.mozSlice ||
4147
false
4248
) // slicing files support
49+
&& !ie10
4350
);
4451

52+
4553
if (!this.support) {
4654
return ;
4755
}
@@ -540,7 +548,8 @@
540548
totalDone += file.progress() * file.size;
541549
totalSize += file.size;
542550
});
543-
return totalSize > 0 ? totalDone / totalSize : 1;
551+
return totalSize > 0 ? totalDone / totalSize :
552+
this.isComplete() ? 1 : 0;
544553
},
545554

546555
/**
@@ -1035,7 +1044,8 @@
10351044
totalDone += file.progress() * file.size;
10361045
totalSize += file.size;
10371046
});
1038-
return totalSize > 0 ? totalDone / totalSize : 1;
1047+
return totalSize > 0 ? totalDone / totalSize :
1048+
this.isComplete() ? 1 : 0;;
10391049
},
10401050

10411051
/**

src/flow/fusty-flow.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ function FustyFlowFile(flowObj, element) {
319319
$.error = true;
320320
$.maxsized = true;
321321
$.abort();
322-
$.flowObj.fire('fileError', $, error);
322+
$.flowObj.fire('fileError', $, 'upload err');
323323
$.flowObj.upload();
324324
return;
325325
}

src/flow/sample/app.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ require([
2121

2222
.run(['$rootScope', function($rootScope) {
2323

24-
$rootScope.target = ''
24+
$rootScope.target = '/'
2525
$rootScope.flowObj = {
2626
flow: null
2727
};
@@ -44,10 +44,11 @@ require([
4444
};
4545
$rootScope.fileSuccess = function($file, $message) {
4646
var id;
47-
$message = angular.fromJson($message);
47+
// $message = angular.fromJson($message);
4848
// do ...
4949
};
5050
var parse2N = function(num) {
51+
if (!num) return '0'
5152
var k1, k2;
5253
k1 = 1024 * 1024 * 1024;
5354
k2 = 1024 * 1024;

0 commit comments

Comments
 (0)