jquery .ajax post multiple images and text to php --> mysql
<p>So I have a form that uses jquery $.ajax to call a php script. My problem is I haven't found any way to send both text input and file input or images. I can send the text, just the not the images too.</p>

<p>heres what I got:</p>

<p>Javascript:</p>

<p>else {</p>

<pre><code>        $.ajax({
            type: 'POST',
            url: 'test1.php',
            cache: false,
            data: $(".contact_form").serializeArray(),
            success: function (data) {
                if (data == "error") {
                    $('.success_box').hide();
                    $('.error_box').show();
                }
                else {
                    $('#sname').val('');
                    $('#email').val('');
                    $('#title').val('');
                    $('#message').val('');
                    $('#photo1').val('');
                    $('#photo2').val('');
                    $('.error_box').hide();
                    $('.success_box').show();
                }
            }
        });
    }
</code></pre>

<p>PHP:</p>

<pre><code>    &lt;?php
$sname=$_POST['sname'];
$email=$_POST['email'];
$title=$_POST['title'];
$description=$_POST['message'];
$photo1=$_FILES['photo1']['tmp_name'];
$photo2=$_FILES['photo2']['tmp_name'];

$link = mysql_connect("localhost","root","root");

if (!$link) {
    die(mysql_error());
    echo('link stop');  
}
$db = mysql_select_db("test");

if (!$db) {
    die(mysql_error()); 
    echo('braaahh');
}   
    $imge1 = addslashes(file_get_contents($_FILES['photo1']['tmp_name']));
    $imge2 = addslashes(file_get_contents($_FILES['photo2']['tmp_name']));

if (!mysql_query("INSERT INTO forSale VALUES ('', '$sname', '$email', '$title',         '$description', '$imge1', '$imge2')")) {
    die(mysql_error());
    echo("help");
}   

mysql_close();
    ?&gt;
</code></pre>

<p>thanks </p>
