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
https://forums.phpfreaks.com/topic/142576-send-to-new-page-after-file-upload/
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> 

i am no javascript expert and i don't have any expert knowledge on uploading control with javascript but i do know it is very hard.

i have used the xajax project a few times and i know if you search the forums there is one guy developing a plug-in for file uploading it might be of some use

 

Scott.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.