i have form file delete anybody can help make file clone instead of delete.

<?php

if(isset($_POST['filed'])){
   unlink($_POST['file']);
}

?>



<form action="delet.php" method="post">
<b>Name of file(on the server):</b><INPUT type='text' Name='file'><Br>
<INPUT type='Submit' Name='filed' Value='Delete File'>
</form>  

Recommended Answers

You cannot just do this

 <?php
    if(isset($_POST['filed'])){
    rename($_POST['file']);
    }
?>

and expect for the magical moments to occur. The reason I have provided you with the link above is for you to use them as reference and to learn more about them.

the rename function …

Jump to Post

All 4 Replies

You can use either one

rename

copy

not working

    <?php
  if(isset($_POST['filed'])){
    rename($_POST['file']);
    }
    ?>

You cannot just do this

 <?php
    if(isset($_POST['filed'])){
    rename($_POST['file']);
    }
?>

and expect for the magical moments to occur. The reason I have provided you with the link above is for you to use them as reference and to learn more about them.

the rename function syntax is like this

rename("directory_where_file_is_located/name_of_the_file_to_be_rename.ext", "directory_where_the_renamed_file_is_to_saved/new_name_of_the_file.ext");

hello veedeoo
why asking help? becuase i am new to php get me better help don't hesitate.
just update below whatever showing rename purpose.

 <?php
if(isset($_POST['filed'])){
rename($_POST['file']);
}
?>
Be a part of the DaniWeb community

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