Jump to content

rename file


ZulfadlyAshBurn

Recommended Posts

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

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.