ZulfadlyAshBurn Posted February 8, 2011 Share Posted February 8, 2011 i coded this and it works previously but now its not working. its say: syntax error, unexpected $end. below in the code which rename the files <?php session_start(); if(!isset($_SESSION['myusername'])){ header("location:index.php"); } else { // get the new and prev file name $newn = $_POST[ 'filename' ]; $prevn = $_POST[ 'filepg' ]; // get user directory path $dirpath = "u/" . ($_SESSION['myusername']) . "/"; // new filename $newn = "$dirpath$newn"; //old filename $prevn = "$dirpath$prevn"; // rename to file rename("$prevn", "$newn"); echo "<center><br><br><h2>"; echo "The file $prevn has been renamed to $newn!</h2></center>"; header( 'refresh: 2; url=files.php' ); ?> Link to comment https://forums.phpfreaks.com/topic/227062-rename-file/ Share on other sites More sharing options...
micmania1 Posted February 8, 2011 Share Posted February 8, 2011 You have no closing '}' Link to comment https://forums.phpfreaks.com/topic/227062-rename-file/#findComment-1171419 Share on other sites More sharing options...
ZulfadlyAshBurn Posted February 8, 2011 Author Share Posted February 8, 2011 thanks micmania1. I totally forget and never realised it. Link to comment https://forums.phpfreaks.com/topic/227062-rename-file/#findComment-1171426 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.