AceOfJames Posted January 27, 2009 Share Posted January 27, 2009 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; } Quote Link to comment Share on other sites More sharing options...
ratcateme Posted January 27, 2009 Share Posted January 27, 2009 this is clearly a javascript question not a php question but here is a javascript redirect http://www.tizag.com/javascriptT/javascriptredirect.php you proberly want the second one it has a timeout on it Scott. Quote Link to comment Share on other sites More sharing options...
AceOfJames Posted January 27, 2009 Author Share Posted January 27, 2009 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> Quote Link to comment Share on other sites More sharing options...
ratcateme Posted January 27, 2009 Share Posted January 27, 2009 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. Quote Link to comment Share on other sites More sharing options...
haku Posted January 27, 2009 Share Posted January 27, 2009 This javascript is in fact in a php app. The code you posted is not php. It's javascript. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.