i use Bootstrap and have a Form in Modalbox.
There is also a Fileupload and i want to Upload Images, but if i click the Submit button, the Site looks like reloading instant and there is no File Uploading...
Here is my Ajax Script
<script type="text/javascript">
$("#submitad").click(function () {
$.ajax({
url: "application/views/addad.php",
type: "POST",
data: $("#addad").serialize(),
success: function (data)
{
alert(data);
}
});
});
</script>
And this is the html form field for upload
Here the PHP thing
<?php
$target_dir = "uploads/";
$filename = basename($_FILES["InputFile"]["name"]);
$target_file = $target_dir . $filename;
$imageFileType = pathinfo($target_file, PATHINFO_EXTENSION);
$check = getimagesize($_FILES["InputFile"]["tmp_name"]);
if ($check !== false) {
echo "File is an image - " . $check["mime"] . ".";
} else {
echo "File is not an image.";
}
?>
But its not working...
if i kicked that out of php file it saves my other fields with type="text" and numbers
But File upload doesnt work and i already tried much of i find on google