Rename files from a directory

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
FernandoBasso
Forum Newbie
Posts: 13
Joined: Sun Dec 05, 2010 4:05 am
Location: Brazil

Rename files from a directory

Post by FernandoBasso »

I have this code:

Code: Select all

echo("<a href='$dir$arq'>$arq</a>
<a href=\"delfile.php?action=delete&filename=$dir$arq\"
 onclick=\"return confirm('Sure?')\">Deletar</a>
<a href=\"renfile.php?action=rename&filename=$dir$arq\">Renomear</a>
<br>");
When I clicke "Deletar", everything works fine. When I click rename, I see a URL similar to
"http://localhost:8080/Downloads/delfile ... _11_11.png"
and nothing shows in the page. Even "View Source" shows nothing.

This is the rename code I was preparing. It does nothing so far because since I can't at least
see the old name and nothing shows up I can't try to program any further.

Code: Select all

<?php
/* User clicou o link "Renomear". */
if ($_GET['action]' && $_GET['action'] == 'rename') {

    //$oldname = $_GET['filename'];
    echo $_GET['filename'];
    //echo("$oldname <br>");
}
?>

<p><a href='index.php'>Início.</a></p>

Any help would be appreciated. Thanks in advance.
Post Reply