{ "id": "87176", "key": "TIMOB-7850", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" }, { "id": "13170", "name": "Sprint 2012-06", "archived": true, "released": true, "releaseDate": "2012-03-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-03-12T14:27:24.000+0000", "created": "2012-02-29T13:22:03.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "module_network", "parity", "qe-testadded" ], "versions": [ { "id": "12593", "name": "Release 2.0.0", "archived": false, "released": true, "releaseDate": "2012-03-30" }, { "id": "12677", "description": "Release 1.8 Service Pack 1", "name": "Release 1.8.1", "archived": true, "released": true, "releaseDate": "2012-01-31" } ], "issuelinks": [ { "id": "15691", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "87744", "key": "TIMOB-7960", "fields": { "summary": "Android: (Rhino only) Can't upload files via HTTPClient (parity issue)", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-03-13T17:45:14.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h4. Problem description\r\nCustomer wants to upload a file thru a webservice. When we test this code in iOS, works like a charm. When trying to upload with Android, it fails. (same webservice, user, etc).\r\n\r\nh4. Actual Results\r\nThe file can't be uploaded when running the program from Android\r\n\r\nh4. Expected results\r\nThe app being able to upload files to the webservice\r\n\r\nh4. Test case\r\n\r\n1. Create a new mobile project\r\n2. Paste the code\r\n3. Run it\r\n4. Press \"Click\" button\r\n5. See the logs\r\n\r\n{code}\r\nvar win = Titanium.UI.createWindow({\r\n\tbackgroundColor : '#FFFFFF',\r\n\texitOnClose : true,\r\n\tnavBarHidden : true\r\n});\r\n\r\nvar imageView = Titanium.UI.createImageView({\r\n\timage : 'KS_nav_ui.png',\r\n\theight : '46dp',\r\n\twidth : '43dp',\r\n\ttop:'10dp'\r\n});\r\n\r\nwin.add(imageView);\r\n\r\nvar button = Titanium.UI.createButton({\r\n\ttitle : 'Click',\r\n\ttop:'100dp'\r\n});\r\n\r\nbutton.addEventListener('click', function() {\r\n\tuploadImage();\r\n});\r\n\r\nwin.add(button);\r\n\r\nwin.open();\r\n\r\nfunction uploadImage() {\r\n\tvar request = 'http://app.cardfiler.com/cardfiler/c/' + 'UploadCardPhoto';\r\n\tTitanium.API.error('Web Service Call ' + request);\r\n\r\n\tvar req = Titanium.Network.createHTTPClient({\r\n\t\ttimeout : 60000,\r\n\t\tonload : function(e) {\r\n\t\t\tTitanium.API.error('Web Service Response - On Image Upload ' + this.responseText);\r\n\t\t\tvar data = JSON.parse(this.responseText)\r\n\t\t\tif(data.status == true) {\r\n\t\t\t\tTitanium.API.error('uToken is ' + Titanium.App.Properties.getString('uToken'));\r\n\t\t\t\tvar alertDialog = Titanium.UI.createAlertDialog({\r\n\t\t\t\t\ttitle : 'Alert',\r\n\t\t\t\t\tmessage : data,\r\n\t\t\t\t\tbuttonNames : ['OK']\r\n\t\t\t\t});\r\n\t\t\t\talertDialog.show();\r\n\t\t\t} /* else {\r\n\t\t\t\tTitanium.API.error('Response Status false ' + data.message + ' Code ' + data.code);\r\n\t\t\t\tvar alertDialog = Titanium.UI.createAlertDialog({\r\n\t\t\t\t\ttitle : 'Alert',\r\n\t\t\t\t\tmessage : data,\r\n\t\t\t\t\tbuttonNames : ['OK']\r\n\t\t\t\t});\r\n\t\t\t\talertDialog.show();\r\n\t\t\t}*/\r\n\t\t},\r\n\t\tonerror : function(e) {\r\n\t\t\tTitanium.API.error('Web Service Response - On Error' + this.responseText);\r\n\t\t\tvar alertDialog = Titanium.UI.createAlertDialog({\r\n\t\t\t\ttitle : 'Alert',\r\n\t\t\t\tmessage : Titanium.Locale.getString('internet_connection_not_available'),\r\n\t\t\t\tbuttonNames : ['OK']\r\n\t\t\t});\r\n\t\t\talertDialog.show();\r\n\t\t}\r\n\t});\r\n\treq.open('POST', request);\r\n\treq.setRequestHeader(\"ContentType\", \"multipart/form-data\");\r\n\treq.send({\r\n\t\t'aToken' : '60113f81-6f06-4acc-8002-2c0066f88619',\r\n\t\t'uToken' : '9c7ab91c-fccd-4282-b611-c5dec7e402d8',\r\n\t\t'fileType' : 2,\r\n\t\t'fileObject' : imageView.toBlob()\r\n\t});\r\n}\r\n{code}", "attachment": [], "flagged": false, "summary": "Android: Can't upload files via HTTPClient (parity issue)", "creator": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "subtasks": [], "reporter": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "environment": "Titanium SDK version: 1.8.1 / 1.9CI\r\nPlatform & version: Android 2.3\r\nDevice Details: Android emulator \r\nHost Operating System: OSX Lion \r\nTitanium Studio version: 1.0.9", "comment": { "comments": [ { "id": "185495", "author": { "name": "avtarsingh.suchariya", "key": "avtarsingh.suchariya", "displayName": "AvtarSingh Suchariya", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Replace following code with line no. 68 to 73 \r\n\r\nif(Titanium.Platform.name == 'android') {\r\n\r\n req.send({\r\n\r\n 'aToken' : Titanium.Locale.getString('app_token_only'),\r\n\r\n 'uToken' : Titanium.App.Properties.getString('uToken'),\r\n\r\n 'fileType' : '2', // Only Change, Added single quote for Android\r\n\r\n 'fileObject' : blob\r\n\r\n });\r\n\r\n} else {\r\n\r\n req.send({\r\n\r\n 'aToken' : Titanium.Locale.getString('app_token_only'),\r\n\r\n 'uToken' : Titanium.App.Properties.getString('uToken'),\r\n\r\n 'fileType' : 2, // Only Change, No change needed for IPhone\r\n\r\n 'fileObject' : blob\r\n\r\n });\r\n\r\n}\r\n\r\n", "updateAuthor": { "name": "avtarsingh.suchariya", "key": "avtarsingh.suchariya", "displayName": "AvtarSingh Suchariya", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-03-08T05:32:22.000+0000", "updated": "2012-03-08T05:32:22.000+0000" }, { "id": "185638", "author": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thanks for the feedback. PR https://github.com/appcelerator/titanium_mobile/pull/1610 is being reviewed. This should be fixed in 2.0 Release and you will no longer need to use that workaround.", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-03-08T15:30:21.000+0000", "updated": "2012-03-08T15:30:21.000+0000" }, { "id": "185907", "author": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This is a side-effect of our Kroll conversion layer. Unfortunately, since {{req.send}} accepts an object, we must convert every Number we encounter in the object as a Java Double so we don't lose precision when the data is passed into our Java implementation. In practice, this conversion means that when the Java code does a {{toString()}} on the Double object, the result will be {{2.0}} for a JS literal of {{2}}.\r\n\r\nThere isn't an easy way for us to solve this unfortunately, short of completely rewriting our binding layer, which we won't have time for in 2.0. Since the workaround of just quoting the value is working for this use case, it's recommend that you use this workaround until we can find a suitable solution\r\n\r\n", "updateAuthor": { "name": "mculpepper", "key": "mculpepper", "displayName": "Marshall Culpepper", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-03-11T13:31:40.000+0000", "updated": "2012-03-11T13:31:40.000+0000" }, { "id": "186043", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-03-12T12:58:07.000+0000", "updated": "2012-03-12T12:58:07.000+0000" }, { "id": "187057", "author": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing issue\r\n\r\nTested with Ti Studio build 2.0.0.201203182248\r\nTi Mob SDK 2.0.0.v20120319003254 hash r60b6da4c\r\nOSX Lion 10.7.3\r\nNexus S OS 2.3.6\r\n\r\nVerified that this works correctly in v8", "updateAuthor": { "name": "mpettiford", "key": "mpettiford", "displayName": "Michael Pettiford", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-03-19T09:04:12.000+0000", "updated": "2012-03-19T09:04:12.000+0000" }, { "id": "281106", "author": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Anvil test case added.\nPR link:\nhttps://github.com/appcelerator/titanium_mobile/pull/5011", "updateAuthor": { "name": "jithinv@exalture.com", "key": "jithinv@exalture.com", "displayName": "jithinpv", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-11-25T08:22:44.000+0000", "updated": "2013-11-25T08:22:44.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }