You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[XmlHttpRequest] xhr.upload.onprogress not working with xhr.send({uri: 'file:///...'}) #15724
and it works, i have xhr.onload and xhr.onerror and video file is uploaded to youtube and played there.
But i haven't xhr.upload.onprogress.
I try xhr.onprogress, xhr.upload.onprogress, xhr.upload.addEventListener - all of this not works.
BUT!
When i use FormData
let data = new FormData();
data.append('File', {
uri: source.path,
type: source.type,
name: source.name
});
var xhr = new XMLHttpRequest();
xhr.open('PUT', this.url, true);
//xhr.setRequestHeader('Content-Type', this.contentType);
//=== comment this, because it throw error 'multipart != video/mp4'
//xhr.setRequestHeader('Content-Range', 'bytes ' + this.offset + '-' + (end - 1) + '/' + this.filesize);
//=== comment this, because sending data size != filesize
xhr.setRequestHeader('X-Upload-Content-Type', this.filetype);
if (xhr.upload) {
xhr.upload.addEventListener('progress', this.onProgress);
}
xhr.onload = this.onContentUploadSuccess_.bind(this);
xhr.onerror = this.onContentUploadError_.bind(this);
xhr.send(data); <==== FormData
xhr.upload.onprogress is working. But then youtube api return processing error, because it support only 'video/*' and 'application/octet-stream' and does not support 'multipart/form-data'.
What I do wrong and what I need to do for using xhr.upload.onprogress WITHOUT FormData?
At this point this doesn't seem like a particular bug in React Native. The issue may be in your own JavaScript code. I know it's frustrating to see your issues closed but I recommend working on this a bit more, and letting us know if you find that this is definitely an issue that occurs due to a bug in React Native itself. Thanks for understanding.
Activity
hramos commentedon Aug 31, 2017
At this point this doesn't seem like a particular bug in React Native. The issue may be in your own JavaScript code. I know it's frustrating to see your issues closed but I recommend working on this a bit more, and letting us know if you find that this is definitely an issue that occurs due to a bug in React Native itself. Thanks for understanding.
danww commentedon Sep 5, 2017
@1stman: try putting your
xhr.upload.onprogressdefinition before you do yourxhr.open. That may help.Added progress updates for all XMLHttpRequest upload types
Added progress updates for all XMLHttpRequest upload types
Added progress updates for all XMLHttpRequest upload types / fix cras…