I am trying to get a document to be able to pass through some AJAX and jQuery and I just keep getting the C:\fakepath\
when attempting to pass it through. I know this is a security feature within browsers, but I haven't found a way to get past it, so that it passes the doc.
Here's my code, and jsfiddle.
<form method="post" action="contact.php" name="contactform" id="contactform" enctype="multipart/form-data">
<label for="email" accesskey="E"><span class="required">*</span> FBN Document</label>
<input name="fbndoc" type="file" id="fbndoc" size="30" value="" />
jQuery(document).ready(function () {
$('#contactform').submit(function () {
var action = $(this).attr('action');
var values = $.map($('[name^="attribute"]'), function (elem) {
return {
name: elem.name,
value: elem.value
};
});
$("#message").slideUp(750, function () {
$('#message').hide();
$('#submit')
.after('<img src="assets/ajax-loader.gif" class="loader" />')
.attr('disabled', 'disabled');
$.post(action, {
firstname: $('#firstname').val(),
lastname: $('#lastname').val(),
email: $('#email').val(),
contactphone: $('#contactphone').val(),
values: $('values').val(),
fbn: $('#fbn').val(),
fbns: values,
fbnnumber: $('#fbnnumber').val(),
fbnaddress: $('#fbnaddress').val(),
fbncity: $('#fbncity').val(),
fbnstate: $('#fbnstate').val(),
fbnzip: $('#fbnzip').val(),
owneraddress: $('#owneraddress').val(),
ownercity: $('#ownercity').val(),
ownerstate: $('#ownerstate').val(),
ownerzip: $('#ownerzip').val(),
businesstype: $('#businesstype').val(),
otherField: $('#otherField').val(),
commencedate: $('#commencedate').val(),
fbndoc: $('#fbndoc').val(),
comments: $('#comments').val(),
form_type: $('#form_type').val(),
verify: $('#verify').val()
},
function (data) {
document.getElementById('message').innerHTML = data;
$('#message').slideDown('slow');
$('#contactform img.loader').fadeOut('slow', function () {
$(this).remove()
});
$('#submit').removeAttr('disabled');
if (data.match('success') != null) $('#contactform').slideUp('slow');
});
});
return false;
});
});
jsfiddle can be found here: http://jsfiddle.net/g29wQ/