[Javascript] How Do I Upload a File in One Window And SubmittheForm In The Other Window?

Dan Anderson dan at mathjunkies.com
Wed Oct 1 19:27:44 CDT 2003


> 	Whose code?  What did it look like?

I am trying to create a link so that when a user clicks on it a small
window will open, the user will have the ability to upload a file, and
when the user uploads the file it will go back to the main web page.

On the main page the script is:

// this is in the header
function openpopup(){
winpops=window.open("popmeup.html","","width=390,height=490,scrollbars,"); }	

And the link is:

<a href="javascript:openpopup()">Click here to upload a file</a>

On the popup page I have:

	// this is in the header
      function do_it()
      {
       this.form.target=window.opener;
       this.form.submit();
       self.close();
      }

	// this is in the body
      <FORM NAME='form' METHOD=POST ENCTYPE="multipart/form-data">
        <INPUT TYPE=FILE NAME='the_file'>
	<INPUT TYPE=SUBMIT VALUE="Submit Now"
onClick="this.form.target=window.opener; this.form.submit(); 
self.close();">
      </FORM>

The window closes (and I assume) submits the value but the opener never
refreshes.  So nothing happens.  What am I doing wrong?

Thanks for all of your help,

Dan




More information about the Javascript mailing list