I have created a form allowing the user to select a photo. Upon selection, the form is submitted automatically via ajax (as opposed to having a standard submit button). It works fine in all browsers, but it does not work on the mobile version of safari.
My HTML:
<form id="myForm" action="php/upload.php" method="post">
<input name="uploadedfile" type="file" id="uploadPhotoButton"/>
</form>
My javascript:
$(':file').change(function(){
var formData = new FormData($('form')[0]);
$.ajax({
url: 'php/upload.php', //server script to process data
type: 'POST',
success: uploadComplete,
// Form data
data: formData,
//Options to tell JQuery not to process data or worry about content-type
cache: false,
contentType: false,
processData: false
});
});
On iPhone Safari, the change handler function is called fine, but the ajax call fails.
Any suggestions?