upload.php
<?php
echo time();
?>
<br>
<form id="myform" target="mywin" action="file.php" method="post" enctype="multipart/form-data">
<input type=file name="img" onchange="document.getElementById('myform').submit();">
</form>
<img id=img1 src="">
<iframe name=mywin frameborder=0 width=0 height=0></iframe>
<br>
test
file.php
<?php
$tmp=$_FILES;
//print_r($tmp);
$tmp=$tmp["img"]["tmp_name"];
$time=time();
move_uploaded_file($tmp,"upload/".$time.".jpg");
$file=$time.".jpg";
//echo $file;
echo "<script>top.document.getElementById('img1').src='upload/".$file."';</script>";
?>