Page 1 of 1

rename & unlink

Posted: Fri Feb 13, 2004 2:30 pm
by ol4pr0
How would i go best to have a file extension being changed,
and or deleted...

i got me this .. not all of it works like the delete part... the change part goes well...

For as about the delete part i get this error...., any help in the good direction would help ;-)

Code: Select all

if (!isset($action)) {
    $action = "900";
}

switch($action) {
	
default:

echo "
<form action=$PHP_SELF?action=change method=post>
<input type=button name=submit value=Change>
</form>";

case "change":

rename("files/down/resulta.xml", "files/down/resulta.dat");

break;

echo "
<form action=$PHP_SELF?action=del method=post>
<input type=button name=submit value=Delete>
</form>";

case "del":

unlink("files/down/resulta.dat");
}
break;


?>

// my error

Warning: rename(files/down/resulta.xml,files/down/resulta.dat): No such file or directory in C:\Apache2\htdocs\tms\up\test.php on line 31

Fatal error: Cannot break/continue 1 level in C:\Apache2\htdocs\tms\up\test.php on line 44