|
57 | 57 | * Check if directory upload is supported |
58 | 58 | * @type {boolean} |
59 | 59 | */ |
60 | | - this.supportDirectory = /Chrome/.test(window.navigator.userAgent); |
| 60 | + this.supportDirectory = ( |
| 61 | + /Chrome/.test(window.navigator.userAgent) || |
| 62 | + /Firefox/.test(window.navigator.userAgent) || |
| 63 | + /Edge/.test(window.navigator.userAgent) |
| 64 | + ); |
61 | 65 |
|
62 | 66 | /** |
63 | 67 | * List of FlowFile objects |
|
97 | 101 | initFileFn: null, |
98 | 102 | readFileFn: webAPIFileRead |
99 | 103 | }; |
100 | | - |
| 104 | + |
101 | 105 | /** |
102 | 106 | * Current options |
103 | 107 | * @type {Object} |
|
155 | 159 | /** |
156 | 160 | * Set a callback for an event, possible events: |
157 | 161 | * fileSuccess(file), fileProgress(file), fileAdded(file, event), |
158 | | - * fileRemoved(file), fileRetry(file), fileError(file, message), |
| 162 | + * fileRemoved(file), fileRetry(file), fileError(file, message), |
159 | 163 | * complete(), progress(), error(message, file), pause() |
160 | 164 | * @function |
161 | 165 | * @param {string} event |
|
518 | 522 | */ |
519 | 523 | resume: function () { |
520 | 524 | each(this.files, function (file) { |
521 | | - file.resume(); |
| 525 | + if (!file.isComplete()) { |
| 526 | + file.resume(); |
| 527 | + } |
522 | 528 | }); |
523 | 529 | }, |
524 | 530 |
|
|
579 | 585 | var files = []; |
580 | 586 | each(fileList, function (file) { |
581 | 587 | // https://github.com/flowjs/flow.js/issues/55 |
582 | | - if ((!ie10plus || ie10plus && file.size > 0) && !(file.size % 4096 === 0 && (file.name === '.' || file.fileName === '.')) && |
583 | | - (this.opts.allowDuplicateUploads || !this.getFromUniqueIdentifier(this.generateUniqueIdentifier(file)))) { |
584 | | - var f = new FlowFile(this, file); |
585 | | - if (this.fire('fileAdded', f, event)) { |
586 | | - files.push(f); |
| 588 | + if ((!ie10plus || ie10plus && file.size > 0) && !(file.size % 4096 === 0 && (file.name === '.' || file.fileName === '.'))) { |
| 589 | + var uniqueIdentifier = this.generateUniqueIdentifier(file); |
| 590 | + if (this.opts.allowDuplicateUploads || !this.getFromUniqueIdentifier(uniqueIdentifier)) { |
| 591 | + var f = new FlowFile(this, file, uniqueIdentifier); |
| 592 | + if (this.fire('fileAdded', f, event)) { |
| 593 | + files.push(f); |
| 594 | + } |
587 | 595 | } |
588 | 596 | } |
589 | 597 | }, this); |
|
691 | 699 | * @name FlowFile |
692 | 700 | * @param {Flow} flowObj |
693 | 701 | * @param {File} file |
| 702 | + * @param {string} uniqueIdentifier |
694 | 703 | * @constructor |
695 | 704 | */ |
696 | | - function FlowFile(flowObj, file) { |
| 705 | + function FlowFile(flowObj, file, uniqueIdentifier) { |
697 | 706 |
|
698 | 707 | /** |
699 | 708 | * Reference to parent Flow instance |
700 | 709 | * @type {Flow} |
701 | 710 | */ |
702 | 711 | this.flowObj = flowObj; |
703 | | - |
| 712 | + |
704 | 713 | /** |
705 | 714 | * Used to store the bytes read |
706 | 715 | * @type {Blob|string} |
|
735 | 744 | * File unique identifier |
736 | 745 | * @type {string} |
737 | 746 | */ |
738 | | - this.uniqueIdentifier = flowObj.generateUniqueIdentifier(file); |
| 747 | + this.uniqueIdentifier = (uniqueIdentifier === undefined ? flowObj.generateUniqueIdentifier(file) : uniqueIdentifier); |
739 | 748 |
|
740 | 749 | /** |
741 | 750 | * List of chunks |
|
1482 | 1491 | each(query, function (v, k) { |
1483 | 1492 | data.append(k, v); |
1484 | 1493 | }); |
1485 | | - data.append(this.flowObj.opts.fileParameterName, blob, this.fileObj.file.name); |
| 1494 | + if (typeof blob !== "undefined") data.append(this.flowObj.opts.fileParameterName, blob, this.fileObj.file.name); |
1486 | 1495 | } |
1487 | 1496 |
|
1488 | 1497 | this.xhr.open(method, target, true); |
|
1600 | 1609 | * Library version |
1601 | 1610 | * @type {string} |
1602 | 1611 | */ |
1603 | | - Flow.version = '2.11.2'; |
| 1612 | + Flow.version = '2.13.0'; |
1604 | 1613 |
|
1605 | 1614 | if ( typeof module === "object" && module && typeof module.exports === "object" ) { |
1606 | 1615 | // Expose Flow as module.exports in loaders that implement the Node |
|
0 commit comments