посмотрите, что "сотворил" я, направьте на путь истинный, ибо как вставить картинку во фрейм, я не понял немного
<script>
function check(newer)
{
params = "#uploader"
request = new ajaxRequest()
request.open("POST", "upload.php", true)
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
request.setRequestHeader("Content-length", params.length)
request.setRequestHeader("Connection", "close")
request.onreadystatechange = function()
{
if (this.readyState == 4)
{
if (this.status == 200)
{
if (this.responseText != null)
{
document.getElementById('uploader').style.display='inherit';
<?php
if (isset($_FILES['image']['name']))
{
$saveto = "lmt_image/ava.jpg";
$dir = "lmt_image";
if (!file_exists($dir))
{
$old = umask(0);
mkdir($dir,0777);
umask($old);
}
move_uploaded_file($_FILES['image']['tmp_name'], $saveto);
}
?>
}
else alert("Ajax error: No data received")
}
else alert( "Ajax error: " + this.statusText)
}
}
request.send(params)
}
function ajaxRequest()
{
try
{
var request = new XMLHttpRequest()
}
catch(e1)
{
try
{
request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch(e2)
{
try
{
request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch(e3)
{
request = false
}
}
}
return request
}
</script>
<form action="#uploader" name="photo" enctype="multipart/form-data" onsubmit="check(this)" method="post">
<input type="file" name="image" size="30" />
<input type="submit" name="upload" value="Upload" />
</form>
<iframe name="uploader" id="uploader" style="display: none;"></iframe>