xamonix Posted March 14, 2012 Share Posted March 14, 2012 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? $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 ; } Thank you for your time and help! Link to comment https://forums.phpfreaks.com/topic/258938-replacing-or-removing-portuguese-characters-from-filename/ Share on other sites More sharing options...
smerny Posted March 14, 2012 Share Posted March 14, 2012 this should help http://www.php.net/manual/en/normalizer.normalize.php Link to comment https://forums.phpfreaks.com/topic/258938-replacing-or-removing-portuguese-characters-from-filename/#findComment-1327429 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.