my code is uploading anything what i want. Problem is that it is not entering in the page show.php. Although i did debug and failed to understand why this is not going to other page.

**show.php**

<?php
echo"heloo00";
$con=mysql_connect("localhost","root",'');
mysql_select_db("project",$con) or die("error db");

$sql="select * from upload";
$query=mysql_query($sql);
while($row=mysql_fetch_array($query))
{
$image=$row ['name'];

echo '<img src="data:image/png;base64,' . base64_encode( $row['content'] ) . '" />';
}
?>

**test.php**

<html>
<head>
<style>
#boox{
overflow:auto;
width:600px;
height:400px;
}
</style>

<script>
alert("helo");
</script>
<script>

function pict()
{ alert("hel");
xmlhttp = new XMLHttpRequest();
var picInput = document.getElementById('userfile').value;
var uploadpic = document.getElementById('upload').value;
document.getElementById('usf').innerHTML = picInput;
document.getElementById('upic').innerHTML = uploadpic;
xmlhttp.onreadystatechange = function () {

if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var resp = xmlhttp.responseText;
alert(resp);
} alert("a");
xmlhttp.open( "POST", 'show.php', true); //POST Because you use $_POST in php
xmlhttp.send();
}

}
</script>
</head>
<div id="boox">
<?php
if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0)
{
$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];
$fp = fopen($tmpName, 'r');
$content = fread($fp, filesize($tmpName));
$content = addslashes($content);
fclose($fp);
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}
$con=mysql_connect("localhost","root",'');
mysql_select_db("project",$con) or die("error db");

$query = "INSERT INTO upload (name, size, type, content ) ".
"VALUES ('$fileName', '$fileSize', '$fileType', '$content')";
mysql_query($query) or die('Error, query failed');
mysql_close($con);
echo "<br>File $fileName uploaded<br>";

}
?>
</div>
<body>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="2000000">
<input name="userfile" type="file" id="userfile">
<input name="upload" type="submit" onClick="pict()" class="box" id="upload" value=" Upload ">
</form>
</body>
</html>