+ Start a Discussion
S PawarS Pawar 

Redirecting control to the same visual force page after uploading a file




After uploading a file  using apex:inputFile tag of visualForce page i'm redirected to My Personal Documents.

But I want to redirect my control to the same visualforce page along with the message file uploded successfully










You can use the PagrReference Class ..

     function redirect(){
 window.onload = window.setTimeout(redirect(),5000);


You can use javascript code for passing parameter while redirecting. ..

public PageRefernce SaveRedirect{

insert document;
PageReference pg = new PageReference('/apex/thankyoupage');

return pg;


Important :

Hit Kudos if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.

Thank You

Deepak Kumar ShyoranDeepak Kumar Shyoran

Hi S Pawar ,


You can also prevent to redirect your page by setting the reRender attribute to "none"  in your action function that will also prevent to redirect your page on Document page.



If this post helps you then hit kudus by clicking on star and accept my post as a solution to your question.