Hi i am new in this website and i hope i have fun with all the members here,
I am trying to make code that get all the names of the files from folder and beside each one link to delete it
This is the code i have done but dunno why not working
The Full Code:
<?php
if($_GET['do'] == 'delete')
{
unlink($myFile);
}
$myFile = $files[$i];
$collection = "";
$files = glob("gallery/*.*");
for
($i=0; $i<count($files); $i++) { $collection = $collection."\"".$files[$i]."\"".",". '<a href="index.php?do=delete">Delete file</a>.';}
echo $collection;
?>
This part get the files names from the folder "gallery/" and post it:{And its working Perfect
<?php
$collection = "";
$files = glob("gallery/*.*");
for
($i=0; $i<count($files); $i++) { $collection = $collection."\"".$files[$i]."\"<br />";}
echo $collection;
?>
This Part Which Delete the file (And its working perfect alone)
The Full Code:
<?php
if($_GET['do'] == 'delete')
{
unlink($myFile);
}
$myFile = "Name Of The File";
?>
<a href="index.php?do=delete">Delete file</a>
But now i want him Automatic get the name of the file i want him to delete
when i try to change the "Name Of The File" with
<?php $myFile = $files[$i]; ?>
Not Working :/
So how i make him get the Name Of The File I Want To Delete?