Re: automatic file-rename trigger on upload

  •  05-30-2011, 2:49 PM

    Re: automatic file-rename trigger on upload

    Dear Cassiopeia,
     
    Please open "\cuteeditor_files\Dialogs\upload_handler.php", you can find the following code in this file:
     
    foreach($guidlist as $fileguid)
     {
      
      //$contentType=$_FILES["file"]["type"];
      $mvcfile=$uploader->GetUploadedFile($fileguid);
      if(!$mvcfile)continue;
      
      $f_basename = $mvcfile->FileName;       
      $f_basename = preg_replace("/[^a-zA-Z0-9s.]/", "_", $f_basename);
      $savepath=$C_AbsolutePath . '' . $f_basename; 
      
      
      if(is_file($savepath))
      {
       unlink($savepath);
      }  
      $mvcfile->MoveTo($savepath);   
      chmod($savepath, 0644);  
      echo "The file ". $f_basename . " has been uploaded successfully! <br>";
      echo "File size: ". FormatSize( $filesize) .".";
      echo "<script language=javascript>parent.UploadSaved('" . $filepath . $f_basename . "','". $filepath ."');</script>"; 
     }
     
    You can update this code  and implement your requirement.
     
    Thanks for asking
View Complete Thread