Replacing or removing portuguese characters from filename
Posted: Wed Mar 14, 2012 3:02 pm
Hi !
I got this script to upload images, but as a portuguese website I need to clean or replace the portuguese characters like "ã" or "ç" from user's filename. The script is the following. What lines should I add to the script to get the desired result?
Thank you for your time and help!
I got this script to upload images, but as a portuguese website I need to clean or replace the portuguese characters like "ã" or "ç" from user's filename. The script is the following. What lines should I add to the script to get the desired result?
Code: Select all
$userfile2=(isset($_FILES['userfile']['tmp_name']) ? $_FILES['userfile']['tmp_name'] : "");
$userfile_name=(isset($_FILES['userfile']['name']) ? $_FILES['userfile']['name'] : "");
$imagesize = $_FILES['userfile']['size'];
if (( $imageenabled == 2 ) || ( ($imageenabled == 1) && (!empty($userfile_name)) ) ) {
$base_Dir = ELPATH.'/../../images/eventlist/events/';
$sizelimit = $sizelimit*1024; //size limit in kb
if (!move_uploaded_file ($_FILES['userfile']['tmp_name'],$base_Dir.$_FILES['userfile']['name']) || !mosChmod($base_Dir.$_FILES['userfile']['name'])) {
echo "<script> alert('Image not sent!.'); window.history.go(-1); </script>\n";
exit();
} else {
$file = $base_Dir.$userfile_name;
//chmod Bild
@chmod ($file, octdec($imagechmod));
//Vorbereiten auf Thumbnailerstellung
$thumbdir = $base_Dir.'small/';
$save = $thumbdir.$userfile_name ;
if ($imageprob = 1) {
$imageprob = TRUE;
} else {
$imageprob = FALSE;
}
if ($gddisabled == 1) {
evlist_imgd::thumb($file, $save, $imagewidth, $imagehight, $imageprob);
}
}
$_POST['datimage'] = $userfile_name ;
}