-1
フォルダから1つのファイルを削除するにはどうすればよいですか?削除リンクをクリックすると、アップロードされたすべてのファイルがフォルダから削除されます。フォルダから1つのファイルを削除するにはどうすればよいですか?
リンク:
<td><a href="Ad_delete.php?$Id=<?php echo $Row['Id'];?>" onClick="return confirm('Are you sure you want to delete this selected file ?')">Delete</a>
コード:
<?php
// Including the database connection file
include_once 'Ad_updbconnect.php';
// Getting Id of the data from url
$Id = $_GET['Id'];
$Del = glob('uploads/*'); // Get all file names
foreach ($Del as $File) {
if (is_file($File)) {
unlink($File); // delete file !
}
}
// Deleting the row from table
$Result = mysqli_query ($Con, "DELETE FROM ibgsec_uploads WHERE Id=$Id");
$Row = mysqli_fetch_array($Result);
// Redirecting to the display page.
header("location: Ad_uploads.php");
?>
これは私が働いている残された唯一の事ですが、私は適切にコマンドを実行するための多くの方法を試みたが、それしました動作しません。