Xhr upload to php

I’m building an iphone app (using titanium) and am trying to pass an image to my website. I’m using a xhr post and I can see that it returns a status of 200 and a ready state of 4 which tells me the server is good.

My php is simple

<?php if ($_FILES ) { echo 'hit the server'; } else { echo 'No data received'; } ?>

However I never get a response from the server. Also I am seeing in my error log ModSecurity: Multipart parsing error (init): Multipart: Invalid boundary in C-T (malformed). Which from some googling seems to be a problem with ModSecurity.

I was wondering if anyone else has had a similar issue. Or if you have been able to successfully push an image to your site via xhr would you mind sharing how you did it?