Passing form data to new window (javascript?)

Soldato
Joined
25 Nov 2004
Posts
4,788
Location
Hertfordshire
Basically I'm trying to implement a very basic image uploader on my site and I'm trying to get a window to pop up with the image data (URL/IMG tags etc) rather than it displaying in the same window.

It works when I use the target="_blank" parameter on the form, but obviously I can't control the dimensions of the new window (ideally wanting 640x480).

I tried a javascript method, with the script in the <head> section...

Code:
<script type="text/javascript">
<!--
function DoSubmit(form){
    var winName = 'data' + '_win';
	window.open('', 'popup', 'scrollbars=no, width=150, height=100');
	form.target = 'popup';
	form.submit();
	}
// -->
</script>

along with the form, in the <body> section...

Code:
<FORM NAME="Data" ENCTYPE="multipart/form-data" ACTION="http://www.infsq.co.uk/upload/upload.php" onsubmit="DoSubmit(this);" METHOD="POST">
        <strong><font color="#bd934f" face="Geneva, Arial, Helvetica, sans-serif">Image File </font></strong><font color="#bd934f">:</font>
        <INPUT TYPE="file" NAME="userfile">
        <INPUT TYPE="Submit" VALUE="Upload" NAME="Data">
</FORM>

But it still loads in the same page, no errors or anything. I'm a bit of a novice when it comes to javascript - the above bit of code is something I found online so I'm not 100% sure it would even work.

If it makes any difference, I'm using EzStatic for executing the integrated php code on my wordpress page.

Where am I going wrong?
 
Back
Top Bottom