Skip to content

Commit a5fa7c2

Browse files
committed
generate a unique id for each uploader instance.
1 parent ecd2357 commit a5fa7c2

5 files changed

+13
-17
lines changed

dist/deep-uploader.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,6 @@ FileTrigger.trigger = function (element, profile, callback) {
341341

342342
for (var i = 0; i < files.length; i++) {
343343
callback(files[i]);
344-
_eventTrigger2['default'].trigger(element, 'FileAdded', {
345-
element: element,
346-
profile: profile,
347-
file: files[i]
348-
});
349344
}
350345

351346
// Destroy the file input
@@ -383,15 +378,19 @@ var BaseUploader = (function () {
383378
function BaseUploader(element, profile, file) {
384379
_classCallCheck(this, BaseUploader);
385380

381+
this.id = _uuid2['default'].v4();
386382
this.element = element;
387383
this.profile = profile;
388384
this.file = file;
385+
386+
_eventTrigger2['default'].trigger(this.element, 'FileAdded', this._detail());
389387
}
390388

391389
_createClass(BaseUploader, [{
392390
key: '_detail',
393391
value: function _detail() {
394392
return {
393+
id: this.id,
395394
element: this.element,
396395
profile: this.profile,
397396
file: this.file,
@@ -407,9 +406,8 @@ var BaseUploader = (function () {
407406
month = month > 9 ? month : '0' + month;
408407

409408
var fileExt = this.file.name.split('.').pop() || 'tmp';
410-
var fileName = _uuid2['default'].v4();
411409

412-
return year + '/' + month + '/' + fileName + '.' + fileExt;
410+
return year + '/' + month + '/' + this.id + '.' + fileExt;
413411
}
414412
}, {
415413
key: 'start',

dist/deep-uploader.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)