{ "id": "63960", "key": "TIMOB-3328", "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": [], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2017-06-05T22:57:19.000+0000", "created": "2011-04-15T03:42:13.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "image", "photo", "upload" ], "versions": [], "issuelinks": [], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-06-05T22:57:19.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "{html}
Uploading a photo works maybe 1 out of 10 times. A perfect\nexample is to load the Kitchen Sink app onto your iPhone and goto\nXHR -> file upload.
\nOur app uses this same approach and we get the same unfortunate\nfailures. Our server throws the following error:
\nStatus: 500 Internal Server Error bad content body
\n\n/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/utils.rb:467:in `parse_multipart'
\n
\nPlease advise because this is extremely important to us and it\nseems to have been an issue for a few months because here is a post\nfrom someone experiencing a similar issue:
\n\nhttp://developer.appcelerator.com/question/95661/image-upload-image...
I just found that this issue is not just isolated to the\ndevice...it fails on the simulator too, just not as often.
I discovered that uploading to a server on your local computer\nfrom the simulator always works, so it seems to be only be an issue\nwhen uploading to a remote server.
Here is another post from Q&A that is experiencing the same\nissues:
\n\nhttp://developer.appcelerator.com/question/109191/file-upload-fail
I discovered if you comment out these lines of code (201 - 203)\nin ASIFormDataRequest.m everything works just fine:
\n// if ([[self fileData] count] > 0) { // [self\nsetShouldStreamPostDataFromDisk:YES]; // }
\nThis seems to be related to a rack 1.1.0 parsing issue with\nrails 2.3.x that is supposed to be fixed in rails 3.x with rack\n1.2.x, but if anyone is running rails 2.3.x they will encounter\nthese problems and have to comment out the 3 lines of code\nabove.
\nAlso you may want to test this with Engine Yard since you are\npartnering with them.
\nBest,
\nBrian
I looked into the ASI framework some more and found that they\nrecommend you set shouldAttemptPersistentConnection to NO. This\nseems to do the trick even better. So instead of commenting out\nlines (201 - 203) in ASIFormDataRequest.m, all you have to do is\nupdate the TiNetworkHTTPClientProxy.m on line 346 to [request\nsetShouldAttemptPersistentConnection:NO];
Wow...just found the undocumented setting, \"enableKeepAlive\" for\ncreateHTTPClient. Doing the following fixes the issue:
\nxhr = Titanium.Network.createHTTPClient({
\n enableKeepAlive:false\n});
\n
\nPlease update the docs and let people know that when uploading\nimages to set enableKeepAlive to false.