Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-3328] xhr photo upload broken on device

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2017-06-05T22:57:19.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsiOS
Labelsimage, photo, upload
ReporterBrian
AssigneeIngo Muschenetz
Created2011-04-15T03:42:13.000+0000
Updated2017-06-05T22:57:19.000+0000

Description

Uploading a photo works maybe 1 out of 10 times. A perfect example is to load the Kitchen Sink app onto your iPhone and goto XHR -> file upload.

Our app uses this same approach and we get the same unfortunate failures. Our server throws the following error:

Status: 500 Internal Server Error bad content body

/usr/local/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/utils.rb:467:in `parse_multipart'

Please advise because this is extremely important to us and it seems to have been an issue for a few months because here is a post from someone experiencing a similar issue:

http://developer.appcelerator.com/question/95661/image-upload-image-files-null-over-3g-works-fine-over-wifi"> http://developer.appcelerator.com/question/95661/image-upload-image...

Comments

  1. Brian 2011-04-15

    I just found that this issue is not just isolated to the device...it fails on the simulator too, just not as often.

  2. Brian 2011-04-15

    I discovered that uploading to a server on your local computer from the simulator always works, so it seems to be only be an issue when uploading to a remote server.

  3. Brian 2011-04-15

    Here is another post from Q&A that is experiencing the same issues:

    http://developer.appcelerator.com/question/109191/file-upload-fail"> http://developer.appcelerator.com/question/109191/file-upload-fail

  4. Brian 2011-04-15

    I discovered if you comment out these lines of code (201 - 203) in ASIFormDataRequest.m everything works just fine:

    // if ([[self fileData] count] > 0) { // [self setShouldStreamPostDataFromDisk:YES]; // }

    This seems to be related to a rack 1.1.0 parsing issue with rails 2.3.x that is supposed to be fixed in rails 3.x with rack 1.2.x, but if anyone is running rails 2.3.x they will encounter these problems and have to comment out the 3 lines of code above.

    Also you may want to test this with Engine Yard since you are partnering with them.

    Best,

    Brian

  5. Brian 2011-04-15

    I looked into the ASI framework some more and found that they recommend you set shouldAttemptPersistentConnection to NO. This seems to do the trick even better. So instead of commenting out lines (201 - 203) in ASIFormDataRequest.m, all you have to do is update the TiNetworkHTTPClientProxy.m on line 346 to [request setShouldAttemptPersistentConnection:NO];

  6. Brian 2011-04-15

    Wow...just found the undocumented setting, "enableKeepAlive" for createHTTPClient. Doing the following fixes the issue:

    xhr = Titanium.Network.createHTTPClient({

           enableKeepAlive:false
       });
       

    Please update the docs and let people know that when uploading images to set enableKeepAlive to false.

  7. tom quas 2011-05-06

    Confirmed, we're having these kind of issues w/ Google App Engine's Images API with weak cell signal / EDGE networks.
  8. Lee Morris 2017-06-05

    This version of Kitchen Sink is no longer supported.

JSON Source