Re: File name append when already present

  •  11-28-2012, 7:35 PM

    Re: File name append when already present

    Ok, I put in sode code with a little time stamp to do the job.
    Question however,  Is there a way to NOT use get?
     
    Right now I use this code on a Div that I unhide on a page to upload:
    1. <div class="demo" id="uploaderDiv" style="display:none;">                         
    2.         <h1>Selecting multiple files for upload</h1> 
    3.         <h2><p>You Can select multiple files and upload multiple files at once.</p> 
    4.           <?php     
    5.  
    6.                 $uploader=new PhpUploader(); 
    7.                 $uploader->MaxSizeKB=2150400; 
    8.                 $uploader->Name="myuploader"
    9.                 $uploader->MultipleFilesUpload=true; 
    10.  
    11.                 $uploader->SaveDirectory="/FTP2/WebDisk/Uploaded_Files/"
    12.                 $uploader->InsertText="<br><br>CLICK TO UPLOAD FILE(S)<br>* Max 2 GB *<br><br>Goes to the 'Uploaded Files' Folder.<br><br>"
    13.  
    14.                 $uploader->AllowedFileExtensions="*.jpg,*.png,*.gif";     
    15.                 $uploader->Render(); 
    16.  
    17.             ?> 
    18.                                      
    19.             <ol id="filelist" align="left"
    20.             </ol> 
    21.             <input type="button" name="answer" value="Close" onclick="fadeTrans('uploaderDiv')" style="width:100;" />      
    22. </div> 
    However, with code provided, you were using a form to PUSH to info. Is it possible to do it without a form like I am above:
     
    New code:
     
    1. <div class="demo" id="uploaderDiv" style="display:none;">                         
    2.         <h1>Selecting multiple files for upload</h1> 
    3.         <h2><p>You Can select multiple files and upload multiple files at once.</p> 
    4.      
    5.           <?php     
    6.  
    7.                 $uploader=new PhpUploader(); 
    8.                 $uploader->MaxSizeKB=2150400; 
    9.                 $uploader->Name="myuploader"
    10.                 $uploader->MultipleFilesUpload=true; 
    11.  
    12.                 { 
    13.                 $uploader->InsertText="<br><br>CLICK TO UPLOAD FILE(S)<br>* Max 2 GB *<br><br>Goes to the currently open Folder.<br><br>"
    14.  
    15.                 } 
    16.                 $uploader->AllowedFileExtensions="*.jpg,*.png,*.pdf";     
    17.                 $uploader->Render(); 
    18.          
    19.                 $fileguidlist=@$_POST["myuploader"];  
    20.                     if($fileguidlist)  
    21.                     {  
    22.                     $guidlist=explode("/",$fileguidlist);     
    23.                         foreach($guidlist as $fileguid)      
    24.                         {      
    25.                               
    26.                             //get the uploaded file based on GUID         
    27.                             $mvcfile=$uploader->GetUploadedFile($fileguid);         
    28.                             if($mvcfile)         
    29.                             {         
    30.                                 $path="/FTP2/WebDisk/Uploaded_Files/test/"
    31.                                 $currentfilename=$mvcfile->FileName; 
    32.                                 $time=date('H:i:s').'_'
    33.                                 if(file_exists($path.$currentfilename)) 
    34.                                     { 
    35.                                         $mvcfile->CopyTo($path.$time.$currentfilename);  
    36.                                     } 
    37.                                     else 
    38.                                     { 
    39.                                      $mvcfile->CopyTo($path.$currentfilename); 
    40.                                     } 
    41.                                                              
    42.                                              
    43.                                                
    44.                             }      
    45.                         }      
    46.                       
    47.                     }  
    48.                     ?>  
    49.             <ol id="filelist" align="left"
    50.             </ol> 
    51.             <input type="button" name="answer" value="Close" onclick="fadeTrans('uploaderDiv')" style="width:100;" /> 
    52.          
    53.     </div> 
View Complete Thread