Yorick
10-23-2006, 10:40 AM
Ok guys, I'm stuck at something I'm working on, I wan't to upload a image to my other server, and then return the link to that image to use it.
So i've already made te following:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hello!</title>
<script type="text/javascript">
function uploadform()
{
alert(document.getElementById('target_upload').innerHTML);
document.getElementById('text').innerHTML = document.getElementById('target_upload').innerHTML;
}
</script>
</head>
<body>
<iframe onload="uploadform();" id='target_upload' name='target_upload' src='' style='width:500px;height:150px;border:1'></iframe>
<form action="http://server2.com/index.php" name="upload" action="" method="POST" enctype="multipart/form-data" target="target_upload">
<input name="fileupload" type="file" size="30" />
<input type="button" name="test" value="test" onclick="uploadform();" />
<input type="submit" name="submit" value="Submit" />
</form>
<span id="text">
</span>
</body>
</html>
As you see I wan't to get the contents of the iframe to rip out the link to the image (my other server returns a XML information feed about the uploaded file). But whatever I try I keep getting back a empty innerHTML of the iframe, and because of that also an empty alert.
What am I doing wrong?
Thanks in advcane!
So i've already made te following:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Hello!</title>
<script type="text/javascript">
function uploadform()
{
alert(document.getElementById('target_upload').innerHTML);
document.getElementById('text').innerHTML = document.getElementById('target_upload').innerHTML;
}
</script>
</head>
<body>
<iframe onload="uploadform();" id='target_upload' name='target_upload' src='' style='width:500px;height:150px;border:1'></iframe>
<form action="http://server2.com/index.php" name="upload" action="" method="POST" enctype="multipart/form-data" target="target_upload">
<input name="fileupload" type="file" size="30" />
<input type="button" name="test" value="test" onclick="uploadform();" />
<input type="submit" name="submit" value="Submit" />
</form>
<span id="text">
</span>
</body>
</html>
As you see I wan't to get the contents of the iframe to rip out the link to the image (my other server returns a XML information feed about the uploaded file). But whatever I try I keep getting back a empty innerHTML of the iframe, and because of that also an empty alert.
What am I doing wrong?
Thanks in advcane!