I need to post the file upload to the current page by jquery, then upload the file , and then insert file upload, but the code not work... jquery can't post the file upload to the form:
 <form class="form-inline" role="form" id="form" enctype="multipart/form-data">
 <td colspan="3"><input type="file" name="pic_map" id="pic_map"></td>
 </form>
and this is javascript:
 $('#save').click(function (e) {
    $.post(
            "index.php?page=form1_sub1&pguid=<?php echo $pguid;?>",
            $("#form").serialize()
        )
        .done(function (data) {
            console.log(data);
            window.open('index.php?page=form1_sub2&pguid=<?php echo $pguid;?>', '_self');
        })
        .fail(function () {
            alert('<?php echo _CONNECTION_ERROR; ?>');
        });
});
and this is php code:
 $files = $_FILES['pic_map']['name'];
if(!$db->upload($_FILES['pic_map'], 'uploads/maps/'.$files)) {
    exit('file error');
}
 
    