Live Support, Chat, Upload Control and Rich Text Editor
Welcome to Support forums Sign in | Join | Help |Client Center
in Search

Refreshing the page after upload

Last post 08-21-2009, 8:44 AM by cutechat. 3 replies.
Sort Posts: Previous Next
  •  08-18-2009, 5:28 AM 54757

    Refreshing the page after upload

    Hi,
     
    How would I best go about refreshing the current page after the upload is done?
  •  08-19-2009, 4:30 AM 54790 in reply to 54757

    Re: Refreshing the page after upload

    Richard,
     
    Have you embed the uploader into form tag?
     
    Can you try the following example?
     
    1. <?php require_once "phpuploader/include_phpuploader.php" ?>  
    2. <html>  
    3. <head>  
    4.     <title>  
    5.         Form - Single File Upload   
    6.     </title>  
    7.     <link href="demo.css" rel="stylesheet" type="text/css" />  
    8. </head>  
    9. <body>  
    10.     <div class="demo">  
    11.                            
    12.         <h2>Single File Upload</h2>  
    13.         <p> A basic sample demonstrating the use of the Upload control.</p>  
    14.            
    15.         <!-- do not need enctype="multipart/form-data" -->  
    16.         <form id="form1" method="POST">  
    17.             <?php  
    18.   
    19.             $uploader=new PhpUploader();   
    20.             $uploader->MaxSizeKB=10240;   
    21.             $uploader->MultipleFilesUpload=false;   
    22.             $uploader->Name="myuploader";   
    23.             $uploader->InsertText="Upload File (Max 10M)";   
    24.             $uploader->Render();   
    25.   
    26.             ?>  
    27.         </form>  
    28.            
    29.         <br/><br/>  
    30.                
    31. <?php  
    32. $fileguid=@$_POST["myuploader"];   
    33. if($fileguid)   
    34. {   
    35.     $mvcfile=$uploader->GetUploadedFile($fileguid);   
    36.     if($mvcfile)   
    37.     {   
    38.         echo("<div style='font-family:Fixedsys'>");   
    39.         echo("Uploaded File:");   
    40.         echo("<br/>FileName : ");   
    41.         echo($mvcfile->FileName);   
    42.         echo("<br/>FileSize : ");   
    43.         echo($mvcfile->FileSize);   
    44.         echo("<br/>FilePath : ");   
    45.         echo($mvcfile->FilePath);   
    46.         echo("</div>");   
    47.            
    48.         //Moves the uploaded file to a new location.   
    49.         //$mvcfile->MoveTo("/uploads");   
    50.         //Copys the uploaded file to a new location.   
    51.         //$mvcfile->CopyTo("/uploads");   
    52.         //Deletes this instance.   
    53.         //$mvcfile->Delete();   
    54.     }   
    55. }   
    56. ?>  
    57.                            
    58.     </div>  
    59. </body>  
    60. </html>  

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  08-21-2009, 5:40 AM 54890 in reply to 54790

    Re: Refreshing the page after upload

    That is basically what I do, I think, but as I return the HTML as a result to a function I use GetString(). The HTML should be the same on the client though. After the upload is complete (when it works, it only works about half the times - see my other post regarding temp directory) it just sits there. Hitting F5 will reload the page. I have a list on it with uploaded files that I want to refresh after the upload is complete.
     
    My code:
     

    ". GetUploadHandlerAjaxScript( 'mediaUploader', '/musicbase/upload_media_handler.php' ) ."

          <form method=post action='/index.php'>

           <input type=hidden name='". MUSICBASE_CMD ."' value='". POST_ALBUM ."'>
           <input type=hidden name=album_id value=". fldInteger( $_REQUEST[ 'album_id' ], $conMB ) .">

    <div style='float:left; width:340px;'>
    $media
    </div>

    <div style='float:left; width:240px; padding-left:10px;'>
    ". $uploader->GetString() ."
    <div class='divInstructions' style='width:260px;'>
    <h2>Instruktioner</h2>
    <p>
    Du kan ladda upp en eller flera filer samtidigt och lägga till eller avbryta medans de laddas upp. Lämna inte sidan innan alla filer laddats upp.
    </p>
    </div>
    </div>

          </form>
        ";


    return $res;
     
     
     
  •  08-21-2009, 8:44 AM 54894 in reply to 54890

    Re: Refreshing the page after upload

    Hi,
     
    You need a <form> , and handle the $_POST value ,
     
    Or you need use JavaScript to handle CuteWebUI_AjaxUploader_OnPostback event.
     
    Please check our samples which are included in the downloaded package.
     
    The samples contains both methods.
     
    Regards,
    Terry
View as RSS news feed in XML
Powered by ASP.Net
Copyright 2003 - 2017 CuteSoft Components Inc.. All rights reserved.