Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/FileAPI.Form.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
data.params.push(encodeURIComponent(file.name) + "=" + encodeURIComponent(file.blob));
}
data.start = -1;
data.end = -1;
data.end = data.file.FileAPIReadPosition || -1;
data.retry = 0;
});
},
Expand Down
14 changes: 12 additions & 2 deletions lib/FileAPI.XHR.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
},

_send: function (options, data){

var _this = this, xhr, uid = _this.uid, url = options.url;

api.log('XHR._send:', data);
Expand Down Expand Up @@ -193,10 +194,10 @@
options.pause(data.file, options);

// smart restart if server reports about the last known byte
var lkb = xhr.getResponseHeader('X-Last-Known-Byte');
var lkb = parseInt(xhr.getResponseHeader('X-Last-Known-Byte'));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FF 19: parseInt("08") === 0

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Добавил радикс

api.log("X-Last-Known-Byte: " + lkb);
if (lkb) {
data.end = parseInt(lkb);
data.end = lkb;
} else {
data.end = data.start - 1;
}
Expand All @@ -217,6 +218,15 @@
_this.end(xhr.status);
} else {
// next chunk

// shift position if server reports about the last known byte
var lkb = parseInt(xhr.getResponseHeader('X-Last-Known-Byte'));
api.log("X-Last-Known-Byte: " + lkb);
if (lkb) {
data.end = lkb;
}
data.file.FileAPIReadPosition = data.end;

setTimeout(function () {
_this._send(options, data);
}, 0);
Expand Down