Hoi hope someone can help.

my question is

preg_replace dosn't work 100%

the code i have

$description = preg_replace('/[^a-zA-Z0-9 .,]/', '', ($_POST));

it works with all strange sings but only not when i use sign - between a string like in test-test.

like the code it must remove everyting exept a-z A-Z 0-9 and ., and blank space

then i have the following error

Warning: imagejpeg() [function.imagejpeg]: Unable to open 'test-test/thumbs/thumb083.jpg' for writing: No such file or directory in C:\xampp\htdocs\voor_server_narrengilde\php\login\create_album_prinzenfuhrungen.php on line 772

Warning: imagejpeg() [function.imagejpeg]: Unable to open 'test-test/slides/083.jpg' for writing: No such file or directory in C:\xampp\htdocs\voor_server_narrengilde\php\login\create_album_prinzenfuhrungen.php on line 773


and here i have the code where the line 772 aand 773 is

if (isset($_POST['senden']))
		{
$mapbeschrijving = preg_replace('/[^a-zA-Z0-9 .,]/', '', ($_POST ['expl'])); 
						
							
						 if(mkdir("$mapbeschrijving", 0777)){ if (mkdir("$mapbeschrijving/$slides", 0777)){ if (mkdir("$mapbeschrijving/$thumbs", 0777)){
						include "includes/album_Prinzenfuhrungen_angemacht.php";
							} }}
							else {
						echo "Er is iets niet goed gegaan.";
								}
								$loc1="$slides/$thename";	
						$loc="$thumbs/$thenames";
						$location1="$mapbeschrijving/$slides/$thename";
						$location="$mapbeschrijving/$thumbs/$thenames";
						imagejpeg($image_p1,$location, 100);
						imagejpeg($img,$location1, 100);
						unlink($thename);
											
						include "includes/iffile_Prinzenfuhrungen_exist.php";			
						}

line 12 is line 772 and line 13 is line 773

but it's only when i use - between strings

thanks john

Recommended Answers

All 3 Replies

Works fine for me. What version of PHP are you using.

What happens when you try this:

$mapbeschrijving = preg_replace('/-|[^a-zA-Z0-9 .,]/', '', $_POST['expl']);

i use the latest version i know it's strange
but i have it only where i create a folder for my images

i have found the problem

there was a mistype somewhere in the php code of my site.

i checked everything about 1400 rules.

i was wondering wy it not worked

thanks for your help

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.