Jump to content

Replacing or removing portuguese characters from filename


xamonix

Recommended Posts

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.