-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeletefile.php
68 lines (62 loc) · 1.51 KB
/
deletefile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php include 'filemenu.php' ?>
<div class="container">
<div class="row" style="text-align:center;margin-top:3%">
<div class="col-2">
</div>
<div class="col-8">
<script>
function deleteFile(){
var confirmar=0;
var conf=confirm('Apagar o file?');
if(conf==1){
confirmar=1;
window.location.href="filemenu.php?conf="+confirmar;
}
}
</script>
<?php
//lista de files
$dir="../phpfiles/";
//raiz
$files=glob($dir."*.txt");
//nome do file
$filestxt=glob("*.txt");
$filexlsx=glob("*.xlsx");
$filexls=glob("*.xls");
$filexml=glob("*.xml");
$filejpg=glob("*.jpg");
$filepng=glob("*.png");
?>
<form method="post">
<select name="files" id="framework" class="form-control">
<?php
foreach($filestxt as $allfiles){
echo "<option value=".$allfiles.">".$allfiles."</option>";
}
foreach($filexlsx as $allfiles){
echo "<option value=".$allfiles.">".$allfiles."</option>";
}
foreach($filexls as $allfiles){
echo "<option value=".$allfiles.">".$allfiles."</option>";
}
foreach($filexml as $allfiles){
echo "<option value=".$allfiles.">".$allfiles."</option>";
}
foreach($filejpg as $allfiles){
echo "<option value=".$allfiles.">".$allfiles."</option>";
}
foreach($filepng as $allfiles){
echo "<option value=".$allfiles.">".$allfiles."</option>";
}
echo '</select><input type="submit" name="apagar" value="Apagar File" class="btn btn-primary w-100 mt-3"></form>';
if(isset($_POST["apagar"])){
$file=$_POST["files"];
//Delete File
unlink($file);
header('Refresh:0');
}
?>
</table>
</div>
</div>
</div>