Re: File name append when already present

  •  11-29-2012, 6:32 PM

    Re: File name append when already present

    Thanks. I reworked my implmentation to allow the form to work. The uploader is now on its own page....

    Anyway, Now I have lost the print out for showing the upload status and completion via the ajax handler.

     

    Any suggestions? Here is the code now (I am not showing the ajaz-mutiple file function because is conflicst)

     

     

    1. <html> 
    2. <head> 
    3.  
    4. <link href="demo.css" rel="stylesheet" type="text/css" /> 
    5. </head> 
    6.  
    7. <body> 
    8.                        
    9.         <?php require_once "phpuploader/include_phpuploader.php" ?>  
    10.         <?php session_start(); ?>  
    11.  
    12.         <h1>Selecting multiple files for upload</h1> 
    13.         <h2><p>You Can select multiple files and upload multiple files at once.</p> 
    14.          <h2><p align =center"><a href="mailto:[email protected]?Subject=Upload%20Support" style='color:white; size=15' col ><br>Email support.</a></p> 
    15.                         <form id="form1" method="POST">   
    16.                                                  
    17.                                     <?php 
    18.                                         ob_start(); 
    19.                                         include 'index.php'
    20.                                         ob_end_clean();  
    21.                                         $dir=$_SESSION['phpuploader_dir']; 
    22.                                  
    23.                                         $uploader=new PhpUploader(); 
    24.                                         $uploader->MaxSizeKB=2150400; 
    25.                                         $uploader->Name="myuploader"
    26.                                         $uploader->MultipleFilesUpload=true; 
    27.                              
    28.                                         if ($dir=="../../"
    29.                                             { 
    30.                                             $uploader->InsertText="<br><br>CLICK TO UPLOAD FILE(S)<br>* Max 2 GB *<br><br>Goes to the 'Uploaded Files' Folder.<br><br>"
    31.                                             $path="/FTP2/WebDisk/Uploaded_Files/test/"
    32.                                             } 
    33.                                         else 
    34.                                             { 
    35.                                             $uploader->InsertText="<br><br>CLICK TO UPLOAD FILE(S)<br>* Max 2 GB *<br><br>Goes to the currently open Folder.<br><br>"
    36.                                             $path=$dir
    37.                                             } 
    38.                                         $uploader->AllowedFileExtensions="*.jpg,*.png,*.gif,*.bmp,*psd,*.tiff,*.tga,*.ind,*.ils,*.eps,*.txt,*.ptf,*.zip,*.rar,*.mp3,*.wav,*.bwf,*.aif,*.m4a,*.omf,*.mov,*.m4v,*.mp4,*m4r,*,sd2,*.caf,*.alac,*.pdf";   
    39.                                         $uploader->Render(); 
    40.                            
    41.                                     ?>    
    42.                                     </form> 
    43.                                    <?php  
    44.                         $fileguidlist=@$_POST["myuploader"];  
    45.                         if($fileguidlist)  
    46.                         {  
    47.                         $guidlist=explode("/",$fileguidlist);     
    48.                             foreach($guidlist as $fileguid)      
    49.                             {      
    50.                                   
    51.                                 //get the uploaded file based on GUID         
    52.                                 $mvcfile=$uploader->GetUploadedFile($fileguid);         
    53.                                 if($mvcfile)         
    54.                                 {         
    55.                                                  
    56.                                                 $currentfilename=$mvcfile->FileName; 
    57.                                                 $time=date('H:i:s').'_'
    58.                                                 if(file_exists($path.$currentfilename)) 
    59.                                                     { 
    60.                          
    61.                                                             $mvcfile->CopyTo($path.$time.$currentfilename);  
    62.                                                     } 
    63.                                                     else 
    64.                                                     { 
    65.                                                      $mvcfile->CopyTo($path.$currentfilename); 
    66.                                                     } 
    67.                                                
    68.                                 }      
    69.                             }      
    70.                           
    71.                         }  
    72.                         ?>  
    73.                 <ol id="filelist" align="left"
    74.                 </ol> 
    75.  
    76.  
    77.  
    78.  
    79.     </div> 
View Complete Thread