Can we pass custom varaible to uploader handler

Last post 12-24-2010, 8:39 AM by Eric. 1 replies.
Sort Posts: Previous Next
  •  12-24-2010, 6:54 AM 65518

    Can we pass custom varaible to uploader handler

    Can we pass custom varaible to uploader handler
  •  12-24-2010, 8:39 AM 65521 in reply to 65518

    Re: Can we pass custom varaible to uploader handler

    Dear attu143,
     
    You can change 
     
     $uploader->UploadUrl="myhandler.php";   
     
    to

    $uploader->UploadUrl="myhandler.php?id=301"; 

    It will pass the value to handler.

     

    Custom file upload handler

    If you need further control over the parsing of the file uploading request, you can write a custom file upload handler. In handler page (UploadUrl) developers can rename the uploaded files, process other logics programmatically.

    1.   <?php require_once "phpuploader/include_phpuploader.php" ?>   

    2.   <html>   

    3.   <body>   

    4.          <?php   

    5.               $uploader=new PhpUploader();   

    6.               $uploader->Name="myuploader";   

    7.               //Create a new file upload handler   

    8.               $uploader->UploadUrl="myhandler.php";   

    9.               $uploader->Render();   

    10.         ?>                  

    11. </body>   

    12. </html>  

    The following code shows you how to rename the uploaded files, process other logics programmatically in handler page (UploadUrl).

     

    1.   <?php require_once "phpuploader/include_phpuploader.php" ?>   

    2.   <?php   

    3.       $uploader=new PhpUploader();   

    4.     

    5.       $mvcfile=$uploader->GetValidatingFile();   

    6.     

    7.       if($mvcfile->FileName=="accord.bmp")   

    8.       {   

    9.        $uploader->WriteValidationError("My custom error : Invalid file name. ");   

    10.          exit(200);   

    11.     }   

    12.   

    13.     //USER CODE:   

    14.   

    15.     $targetfilepath= "savefiles/myprefix_" . $mvcfile->FileName;   

    16.     if( is_file ($targetfilepath) )   

    17.      unlink($targetfilepath);   

    18.     $mvcfile->MoveTo( $targetfilepath );   

    19.   

    20.     $uploader->WriteValidationOK();   

    21.   

    22. ?>  

     
    Thank you for asking
    [email protected]
View as RSS news feed in XML