Re: Additional PHP MySQL Data Processing of Uploaded Files

  •  10-29-2012, 10:27 AM

    Re: Additional PHP MySQL Data Processing of Uploaded Files

    Hi PaulARLowe,

     

    Please try the example below, the red code will fire for each file. and you can get the upload file name by $mvcfile->FileName.

     

    1. <?php require_once "phpuploader/include_phpuploader.php" ?>  
    2. <?php session_start(); ?>  
    3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
    4. <html xmlns="http://www.w3.org/1999/xhtml">  
    5. <head>  
    6.     <title>  
    7.         example  
    8.     </title>  
    9.     <link href="demo.css" rel="stylesheet" type="text/css" />  
    10. </head>  
    11. <body>  
    12.             <form id="form1" method="POST">  
    13.                 <?php  
    14.   
    15.                 $uploader=new PhpUploader();  
    16.                 $uploader->MaxSizeKB=10240;  
    17.                 $uploader->MultipleFilesUpload=true;  
    18.                 $uploader->Name="myuploader";  
    19.                 $uploader->InsertText="Select multiple files (Max 10M)";  
    20.                 $uploader->AllowedFileExtensions="*.jpg,*.png,*.gif,*.bmp,*.txt,*.zip,*.rar";      
    21.                 $uploader->Render();  
    22.   
    23.                 ?>  
    24.                   
    25.                 <br/><br/><br/>  
    26.                   
    27. <?php  
    28.   
    29. $files=array();  
    30.   
    31. $processedlist=@$_POST["processedlist"];  
    32. if($processedlist)  
    33. {  
    34.     $guidlist=explode("/",$processedlist);  
    35.     foreach($guidlist as $fileguid)  
    36.     {  
    37.         $mvcfile=$uploader->GetUploadedFile($fileguid);  
    38.         if($mvcfile)  
    39.         {  
    40.             array_push($files,$mvcfile);  
    41.         }  
    42.     }  
    43. }  
    44. $fileguidlist=@$_POST["myuploader"];  
    45. if($fileguidlist)  
    46. {  
    47.     $guidlist=explode("/",$fileguidlist);  
    48.     foreach($guidlist as $fileguid)  
    49.     {  
    50.         $mvcfile=$uploader->GetUploadedFile($fileguid);  
    51.         if($mvcfile)  
    52.         {  
    53.             //Process the file here..  
    54.             //rename(..)  
    55.               
    56.             if($processedlist)  
    57.                 $processedlist$processedlist . "/" . $fileguid;  
    58.             else  
    59.                 $processedlist$fileguid;  
    60.           
    61.             array_push($files,$mvcfile);  
    62.         }  
    63.     }  
    64. }  
    65.   
    66. if(count($files)>0)  
    67. {  
    68.     foreach($files as $mvcfile)  
    69.     {  
    70.         //$mvcfile->FileName is the original file name  
    71.         //save the upload file into D:/sites/phpuploader/test/  
    72.         $mvcfile->CopyTo("D:/sites/phpuploader/test/".$mvcfile->FileName);   
    73.     }  
    74. }  
    75.   
    76. ?>  
    77.               
    78.             </form>  
    79.   
    80. </body>  
    81. </html>  
     

    Regards,

     

    Ken 

View Complete Thread