[AC-400] HTTPClient POST request with file doesn't work on Android
| GitHub Issue | n/a |
|---|---|
| Type | Bug |
| Priority | n/a |
| Status | Resolved |
| Resolution | Cannot Reproduce |
| Resolution Date | 2015-11-11T18:45:11.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | n/a |
| Components | Titanium SDK & CLI |
| Labels | 5.0.0.GA |
| Reporter | David Vermeir |
| Assignee | Mostafizur Rahman |
| Created | 2015-09-29T08:21:41.000+0000 |
| Updated | 2015-11-11T18:45:11.000+0000 |
Description
When trying to do a POST request in Titanium 5.0.0GA, it works as long as you don't include a file. As soon as a file is included the body of the POST is empty on arrival on the server but the file is still there. This issue only seems to occur on Android, iOS has no problems.
I've posted this issue on the Community Q&A and other users seem to be having the same problems.
var mediaParams = { success : function(event) { var imageBlob = event.media; register(imageBlob); }, cancel : function() { }, error : function() { } }; Titanium.Media.openPhotoGallery(mediaParams); function register(image) { var registerData = { username:'test', avatar:image }; var xhr = Ti.Network.createHTTPClient(); xhr.onload = function() { //... }; xhr.onerror = function(error) { //... }; xhr.open('POST', 'http://foo.com/register'); xhr.send(registerData); }Hi , I tested the issue you reported . I can't reproduce it .HTTPClient POST request with file is working fine for me . *Test Code*
Environmentfunction file_transmit(blob) { url = 'http://abc/send_email.php'; var client = Ti.Network.createHTTPClient({ onload : function(e) { var json = JSON.parse(this.responseText); Ti.API.info('this.responseText' + this.responseText); if (json.success === true) { } else { }; }, onerror : function(e) { Ti.API.debug(e.error); }, }); Ti.API.info('blob' + blob); client.open("POST", url); var params = { fileUri : blob }; client.send(params); }ThanksOperating System Name = Mac OS X Version = 10.10.5 Architecture = 64bit # CPUs = 4 Memory = 8589934592 Node.js Node.js Version = 0.10.37 npm Version = 1.4.28 Titanium CLI CLI Version = 5.0.5 Titanium SDK SDK Version =5.0.2 GA SDK Path = /Users/Library/Application Support/Titanium/mobilesdk/osx/5.0.2 GA Target Platform = android