RE: How to delete a file from the server/system?

I want to delete the uploaded file when click on remove button from server permanently

dip Team Leader Asked on February 11, 2017 in PHP.
Add Comment
2 Answers

<div>

<form name="deleteform" action="<?php echo $_SERVER['PHP_SELF'].'?delete=true';?> >

<input type="button" name="picfile" value="<?php echo $file; ?>">

<input type="submit" value="Delete">

</div>

PHP code:


<?php

if(isset($_GET['delete']) && $_GET['delete']=='true') {

unlink("/uploads/".$_POST['picfile']);

}

?>

Team Leader Answered on March 19, 2017.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.