Have been trying to post uploaded document alongside other text fields to a php script using jquery's submit function but so far unsuccessful. The text fields are successfully posted. I have no idea what the problem is. PLease assist.
Jquery submit code
submitHandler: function(form) {
$.post('bin/insert.php', $("#form").serialize(),
function(data) {
if(data.length > 0 )
{
$('.success_box').fadeIn(800);
$('.success_box').html(data);
}
});
}
php script
if(isset($_POST['save']))
{
$upload_dir = "./docs";
$upload_path = $upload_dir."/";
$userfile_name = $_FILES['image']['name'];
$userfile_tmp = $_FILES['image']['tmp_name'];
$userfile_size = $_FILES['image']['size'];
$filename = basename($_FILES['image']['name']);
$file_ext = substr($filename, strrpos($filename, '.') + 1);
$large_image_name = $filename;
if($userfile_name==NULL){
echo "<img src='./warning.png' align='center'>You have not selected a document to upload";
exit();
}
}
I get the above error message on posting the form.