When the ajax form is uploading a file it uses a hidden IFRAME as the target. HTTP_X_REQUESTED_WITH is set when it is submitted using the XMLHttpRequest, but files cannot be uploaded this way.
There isn't any way I know of to detect an AJAX request specifically in this instance (being as this is technically not AJAX) but you can check that HTTP_X_REQUESTED_WITH is not set and that the file is uploaded in $_FILES.