Jump to content

send to new page after file upload


AceOfJames

Recommended Posts

In this function after "The file was uploaded successfully!" I want to send the user to a different page. How would I accomplish that?

 

Thank you in advance!

 

AceOfJames

 

function stopUpload(success){

      var result = '';

      if (success == 1){

        result = '<span class="msg">The file was uploaded successfully!<\/span><br/><br/>';

      }

      else {

        result = '<span class="emsg">There was an error during file upload!<\/span><br/><br/>';

      }

      document.getElementById('f1_upload_process').style.visibility = 'hidden';

      document.getElementById('f1_upload_form').innerHTML = result + '<label>File: <input name="myfile" type="file" size="30" /><\/label><label><input type="submit" name="submitBtn" class="sbtn" value="Upload" /><\/label>';

      document.getElementById('f1_upload_form').style.visibility = 'visible';     

      return true; 

}

 

Link to comment
Share on other sites

Thanks for the clarification on where to post. Sorry about that. This javascript is in fact in a php app. It uploads a file then shoots a success message to the screen but I want the screen to actually refresh or be sent to itself.

 

Here is what I have and it does not work. I added the second (if success) statement to send the user to a new page after the file is uploaded.

 

What is the real way to do this?

 

Thanks!

 

<script language="javascript" type="text/javascript">

<!--

function startUpload(){

      document.getElementById('f1_upload_process').style.visibility = 'visible';

      document.getElementById('f1_upload_form').style.visibility = 'hidden';

      return true;

}

 

function stopUpload(success){

      var result = '';

      if (success == 1){

        result = '<span class="msg">The file was uploaded successfully!<\/span><br/><br/>';

      }

 

      if (success == 1){

'window.location = http://www.google.com/';

      }  

 

 

   

      else {

        result = '<span class="emsg">There was an error during file upload!<\/span><br/><br/>';

      }

      document.getElementById('f1_upload_process').style.visibility = 'hidden';

      document.getElementById('f1_upload_form').innerHTML = result + '<label>File: <input name="myfile" type="file" size="30" /><\/label><label><input type="submit" name="submitBtn" class="sbtn" value="Upload" /><\/label>';

      document.getElementById('f1_upload_form').style.visibility = 'visible';     

      return true; 

}

//-->

</script> 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.