{ "id": "97635", "key": "TIMOB-10036", "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": "13574", "description": "Sprint 2012-15 Core", "name": "Sprint 2012-15 Core", "archived": true, "released": true, "releaseDate": "2012-07-30" }, { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-01-16T23:21:24.000+0000", "created": "2012-07-19T10:41:28.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "core", "module_network", "parity", "qe-ios090112", "qe-testadded" ], "versions": [ { "id": "13273", "description": "Release 2.0.2", "name": "Release 2.0.2", "archived": false, "released": true, "releaseDate": "2012-05-31" }, { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "14137", "description": "Release 2.1.3", "name": "Release 2.1.3", "archived": true, "released": true, "releaseDate": "2012-10-03" } ], "issuelinks": [ { "id": "19003", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "outwardIssue": { "id": "93359", "key": "TIMOB-9590", "fields": { "summary": "Android: Using HTTPClient to PUT an image on Android uploads 15 bytes of text", "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": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-14T04:40:11.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": "12305", "name": "Core", "description": "Central component of the Platform (outside of Tooling, or platform specific implementation details)" } ], "description": "When I run the below code on iOS, the image is not uploaded\r\nAfter TIMOB-9590 fix the code below runs fine on Android, the image uploads successfully.\r\nh4. Repo Steps\r\n1. Run the given code sample in your app.js\r\n2. Click upload image button. \r\n3. It will then display the URL to the uploaded image.\r\n4. Copy URL and open in a browser.\r\n\r\n{code}\r\nvar win1 = Titanium.UI.createWindow({ \r\n title:'Win 1',\r\n backgroundColor:'#fff'\r\n});\r\n\r\nvar img = Ti.UI.createImageView({\r\n\timage: 'http://www.guestassist.net/images/logo.png',\r\n\twidth: 229,\r\n\theight: 66,\r\n\ttop: 20\r\n});\r\n\r\nvar b1 = Ti.UI.createButton({\r\n\ttitle: 'upload image',\r\n\twidth: 200,\r\n\theight: 40,\r\n\ttop: 100\r\n});\r\n\r\nb1.addEventListener('click', uploadImage);\r\n\r\nvar link = Ti.UI.createTextField({\r\n\tvalue: '(url will show here)',\r\n\ttop: 160,\r\n\tleft: 10,\r\n\tright: 10,\r\n\theight: 60,\r\n\tbackgroundColor: 'white',\r\n\tborderColor: '#dddddd',\r\n\tborderWidth: 1,\r\n\tfont: {\r\n\t\tfontSize: 13\r\n\t}\r\n});\r\n\r\nwin1.add(img);\r\nwin1.add(b1);\r\nwin1.add(link);\r\nwin1.open();\r\n\r\nfunction uploadImage()\r\n{\r\n\tvar http = Ti.Network.createHTTPClient({\r\n\t\tonerror: function(e) {\r\n\t\t\tif (JSON.stringify(e).search('The request timed out') >= 0)\r\n\t\t\t{\r\n\t\t\t\tTi.API.info('timeout');\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tTi.API.info('error');\r\n\t\t\t}\r\n\t\t},\r\n\t\tonload: function(e) {\r\n\t\t\tTi.API.info('success!');\r\n\t\t},\r\n\t\tenableKeepAlive: false,\r\n\t\ttimeout: 360000\r\n\t});\r\n\t\r\n\t\r\n\tTi.App.idleTimerDisabled = true;\r\n\tvar d = new Date();\r\n\tvar raw = d.getTime();\r\n\tvar filename = raw + '.png';\r\n\t\r\n\tvar f = Ti.Filesystem.getFile(Ti.Filesystem.tempDirectory + '/' + filename);\r\n\tf.write(img.toBlob());\r\n\t\r\n\tvar uploadFile = Ti.Filesystem.getFile(Ti.Filesystem.tempDirectory, filename);\r\n\tif (!uploadFile.exists()) { alert('file not found'); return false; }\r\n\tvar fileContents = uploadFile.read();\r\n\tvar curDate = 'Wed, 19 June 2011 10:00:00 -0500'; // hard coding date in AWS format for testing\r\n\tvar fileURL = 'https://s3.amazonaws.com/ga-testbucket/images/' + filename;\r\n\t\t\t\r\n\thttp.open('PUT', fileURL, false);\r\n\thttp.setRequestHeader('Content-Type', fileContents.mimeType);\r\n\tif (Ti.Platform.osname != 'android')\r\n\t{\r\n\t\thttp.setRequestHeader('Content-Length', uploadFile.size);\r\n\t}\r\n\thttp.setRequestHeader('Host', 's3.amazonaws.com');\r\n\thttp.setRequestHeader('Date', curDate);\r\n\thttp.setRequestHeader('x-amz-acl', 'public-read');\r\n\thttp.send(uploadFile); // TiFile\r\n\t\r\n\talert('image uploaded!');\r\n\tlink.value = fileURL;\r\n}\r\n{code} ", "attachment": [], "flagged": false, "summary": "iOS: HTTPClient does not support sending TiFile object as documentation states", "creator": { "name": "nsharma", "key": "nsharma", "displayName": "Nikhil Sharma", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "iOS", "comment": { "comments": [ { "id": "208482", "author": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR pending https://github.com/appcelerator/titanium_mobile/pull/2608", "updateAuthor": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-07-19T11:34:25.000+0000", "updated": "2012-07-19T11:34:25.000+0000" }, { "id": "214932", "author": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Environment used for verification -\r\nTested with Titanium SDK: 2.2.0.v20120816212512\r\nTested with Titanium  Studio: 2.1.1.201207271312\r\nDevice - iOS 5.1 simulator\r\nMachine OS - MAC 10.8", "updateAuthor": { "name": "sbhadauria", "key": "sbhadauria", "displayName": "Shyam Bhadauria", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-17T00:10:44.000+0000", "updated": "2012-08-17T00:10:44.000+0000" }, { "id": "220780", "author": { "name": "lokeshchdhry", "key": "lokeshchdhry", "displayName": "Lokesh Choudhary", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Reopening because this issue is still seen in the environment below : \r\nTitanium studio :2.1.2.201208301612\r\nXcode 4.4.1(build with iOS 5.1 SDK):\r\nSDK : 2.1.0 GA\r\nSDK : 2.1.1 GA\r\nSDK : 2.1.2 GA\r\nSDK : 2.1.3.v20120921190208\r\n\r\nXcode 4.5(build with iOS SDK 6.0)\r\nSDK : 2.1.3.v20120921190208\r\n\r\nThe image is not getting uploaded for IOS,whereas for android it works fine.", "updateAuthor": { "name": "lokeshchdhry", "key": "lokeshchdhry", "displayName": "Lokesh Choudhary", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-09-25T21:45:54.000+0000", "updated": "2012-09-25T21:47:22.000+0000" }, { "id": "234693", "author": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The fix went to 3.0.0.GA\r\nPlease retest.", "updateAuthor": { "name": "mstepanov", "key": "mstepanov", "displayName": "Max Stepanov", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-01-16T23:21:24.000+0000", "updated": "2013-01-16T23:21:24.000+0000" }, { "id": "411947", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as fixed.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-14T04:40:11.000+0000", "updated": "2017-03-14T04:40:11.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }