How can i avoid that the page do PostBack after to upload a file?

Last post 03-13-2012, 8:49 AM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  03-13-2012, 6:49 AM 73412

    How can i avoid that the page do PostBack after to upload a file?

    I am using the javascript Method,  CuteWebUI_AjaxUploader_OnTaskComplete(task) to save the file in my DB with AJAX. Must I  to use other method to do this? My phpuploader code in my php is:
     
    <form  enctype="multipart/form-data" action="#">
        <input type="hidden" id='lang' name='lang' value='' />
       ...
        <p> {#linkdesc_dlg.descripcio} <textarea id="Descripcio" name="Descripcio">  </textarea></p>
        
        <p> {#linkdesc_dlg.arxiu}                 
                <?php   
                    // Create Uploader object.   
                    $uploader=new PhpUploader();   
                    // Set a unique name to Uploader   
                    $uploader->Name="myuploader";   
                    $uploader->AllowedFileExtensions="jpeg,jpg,gif,png,zip,rar,pdf,tar";   
                    $uploader->InsertText="Upload File";   
                    $uploader->MultipleFilesUpload=false;   
                    // specify the temporary file location using TempDirectory property   
                    $uploader->SaveDirectory="/var/www/vhosts/weberos.es/copiaWeberos/tmp/upload";
                    $uploader->TempDirectory="/var/www/vhosts/weberos.es/copiaWeberos/tmp/upload";   
                    // Render Uploader   
                    $uploader->Render();   
                ?>   
            
        {#linkdesc_dlg.alerta2}</p>
        ....
    </form>
     
    Thanks!!
  •  03-13-2012, 8:49 AM 73417 in reply to 73412

    Re: How can i avoid that the page do PostBack after to upload a file?

    Hi Vizzent,
     
    If your want to submit the data and upload file at the same time, please use start upload manually example http://phpfileuploader.com/demo/form-manualstart.php  
     
    And please try the example page below, it does not do the post back after file upload
     
    <?php require_once "phpuploader/include_phpuploader.php" ?>
    <?php session_start(); ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>example</title>
    </head>
    <body>
    <div>
    <?php
       $uploader=new PhpUploader();
       $uploader->Name="myuploader";
       $uploader->InsertText="Upload File (Max 10M)";   
       $uploader->Render();
      
      ?> 
    </div>
    </body>
    </html>
     
    Regards,
     
    Ken 
View as RSS news feed in XML