Viewing 1 replies (of 1 total)
  • Thread Starter lagunawebdesign

    (@lagunawebdesign)

    I wrote own php script to change wrong coding/charset

    ...
    			foreach($files as $file){
    
    				$path_parts = pathinfo($file);
    
    				$file_replace = $path_parts['basename'];						
    
    				if(mb_detect_encoding($file_replace, mb_detect_order(), true) == 'UTF-8'){
    
    					$file_replace = iconv("UTF-8", "Windows-1250", $file_replace);
    
    					$new_name = $path_parts['dirname'].DS.$file_replace;
    
    					//rename($file, $new_name);
    					copy($file, $new_name);
    					unlink($file);
    
    				};
    
    //debug($file); debug($new_name); die();				
    
    			}// endforeach file
    ...

    It would be nice to have an option to change FILE NAME (if UTF8 – is special chars) to slug/url valid file name by ONE CLICK in WordPress panel.

Viewing 1 replies (of 1 total)
  • The topic ‘File renaming error!’ is closed to new replies.