[AC-1310] onsendstream for HttpClient does not update progress properly when sending Blob
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Closed |
Resolution | Needs more info |
Resolution Date | 2016-02-01T06:59:33.000+0000 |
Affected Version/s | Appcelerator Studio 4.5.0 |
Fix Version/s | n/a |
Components | Titanium SDK & CLI |
Labels | HttpClient |
Reporter | Stephen Ostrow |
Assignee | Sharif AbuDarda |
Created | 2016-01-22T20:31:39.000+0000 |
Updated | 2016-03-08T07:37:42.000+0000 |
Description
Below is a simplistic test case. In practice I've done this with large blob data of >10M which showed progress = 1 for a minute over and over again.
var httpClient = Ti.Network.createHTTPClient({
onload: function() {
Ti.API.debug("Upload file responseText: " + this.responseText);
},
onerror: function(e) {
Ti.API.error("Error uploading file: " + e.error);
Ti.API.debug("Upload file responseText: " + this.responseText);
},
onsendstream: function(e) {
var progress = parseFloat(e.progress);
Ti.API.trace("Upload progress: " + 100 * progress);
}
});
httpClient.open('POST', 'https://example.org');
// e.progress returns as expected 0.0 - 1.0
var args = {'field1': 'value1'};
httpClient.send(args);
// e.progress will only return 1
var args = Ti.createBuffer({value: 'fields: value1'}).toBlob();
httpClient.send(args);
Hello, Can you provide a full code and data file that you are uploading. We will try to reproduce it in our environment. Assuming you have a server-side service which accepts file uploads, you should find upload fairly straightforward. Titanium already upload a file as a blob if it's a image file. I was trying the below uploading image file code and it's working as expected.
Please provide a complite project that demonstrate the issue. ANd steps to reproduce. Thanks.