$ziel = "../uploadedPics/";
$zielUndDatei = $ziel.$_FILES['bild']['name'];
$max_size = 5242880; // Entspricht 5 Megabyte
$search = array('ä', 'ö', 'ü', 'ß', 'Ä', 'Ö', 'Ü');
$replace = array('ae', 'oe', 'ue', 'ss', 'Ae', 'OE', 'UE');
if($_FILES["bild"]['size']< $max_size)
{
$j = 1;
$pruefe = $ziel.$_FILES['bild']['name'];
if(file_exists($pruefe))
{
do
{
$_FILES['bild']['name']= utf8_encode($_FILES['bild']['name']);// <--------------------------------------------
$filepath = str_replace($search, $replace,$ziel."copy".$j."_of_".$_FILES['bild']['name']);
$filename = str_replace($search, $replace,"copy".$j."_of_".$_FILES['bild']['name']);
$status = file_exists($filepath);
$j++;
}
while($status);
}
else
{
$_FILES['bild']['name']= utf8_encode($_FILES['bild']['name']); // <--------------------------------------------
$filepath = str_replace($search, $replace, $ziel.$_FILES['bild']['name']);
$filename = str_replace($search, $replace, $_FILES['bild']['name']);
}
move_uploaded_file($_FILES["bild"]['tmp_name'], $filepath);
}