How to add rename function? Rename images only if same file name exists like image.jpg, image1.jpg …
function niceURL($string){ //fix file names
$que = array( 'ü','õ','ö','ä',' ','&' );
$por = array( 'u','o','o','a','-','-' );
return strtolower( str_replace( $que,$por,$string ) );
}
foreach($_FILES['file']['tmp_name'] as $key => $value) {
$tempFile = $_FILES['file']['tmp_name'][$key];
$targetFile = $UploadFolder."/".niceURL($_FILES['file']['name'][$key]);
move_uploaded_file($tempFile,$targetFile);
}