for some reason I can't get the $_FILES array to include the upload as selected on my form. From what i have read the form looks ok, and all the other variables are received just fine.
Each time I submit the form the var_dump for the $_FILES array has 0 entries.
For this post i have removed the other fields for the sake of brevity since they are working.
<form name="addFact" id="addFact" action="add_fact.php" method="post" enctype="multipart/form-data" onsubmit="return validateStatus();" >
<input type="file" id="myImage" name="myImage" style="width:450px;"/><br />
</form>
And after I reload I use the following to check the $_FILES array:
echo "- Files - <br>\n";
echo "<pre>\n";
var_dump($_FILES);
echo "</pre>\n";
but the result is empty every time:
Files: array(0) { }
Update sorry, didnt realize validate status was still in there .. but this is the JS that checks whether to submit the form or not
function validateStatus() {
jQuery("#addFact").validationEngine({scroll: false});
var valid = $("#addFact").validationEngine('validate');
if (valid == true) {
submitForm('addFact');
}
return false;
}
Though I doubt that is part of the issue as the form submits successfully with all attributes still set including the file field , etc.
oh ..and lol .. another function .. :) ... here is the submt form function:
function submitForm(formName,message) {
$.ajax({
data: $("#" + formName).serialize(),
type: $("#" + formName).attr('method'),
url: $("#" + formName).attr('action'),
success: function(response) {
$('#load_target').html(response);
}
});
return false;
}
load_target is the div on the index page I am loading this php file into with ajax. - hope that is all clear now :)
Also, to belay any conrens of the form not posting anything .. here are the results for the post var_dump
array(11) {
["action"]=> string(4) "save"
["category"]=> string(1) "3"
["startDate"]=> string(10) "09-27-2012"
["expireDate"]=> string(10) "11-27-2012"
["title"]=> string(10) "Test Title"
["subtitle"]=> string(10) "Test Title"
["include_image"]=> string(3) "yes"
["img_loc"]=> string(4) "left"
["img_size"]=> string(2) ".3"
["scroll"]=> string(1) "1"
["fact_text"]=> string(27) "there's something about her"
}