-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patha3.php
More file actions
95 lines (84 loc) · 1.99 KB
/
Copy patha3.php
File metadata and controls
95 lines (84 loc) · 1.99 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<!DOCTYPE html>
<html>
<body>
<style>
form {
display: inline;
}
</style>
<form>
<input type="button" onclick="myFunction()" value="Convert "/>
</form>
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="file" id="file" onChange="this.form.submit();">
</form>
<?php
$dir = "files/";
echo ("<br>");
// Open a directory, and read its contents
if (is_dir($dir))
{
if ($dh = opendir($dir))
{
while (($file = readdir($dh)) !== false)
{
$array[] = $file;
}
closedir($dh);
foreach($array as $value)
{
if (strpos($value, ".txt") == true || strpos($value, ".html") == true)
{
if (strpos($value, ".info") == false)
{
echo "<a href=files/$value>$value</a><br>";
}
}
}
}
}
if ($_FILES["file"]["error"] > 0)
{
//echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
//echo "Upload: " . $_FILES["file"]["name"] . "<br />";
//echo "Type: " . $_FILES["file"]["type"] . "<br />";
//echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
//echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />";
if (file_exists("files/" . $_FILES["file"]["name"]))
{
//echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
if (move_uploaded_file($_FILES["file"]['tmp_name'],
"files/" . $_FILES["file"]["name"]))
{
//echo "Stored in: " . "files/" . $_FILES["file"]["name"];
echo "<meta http-equiv='refresh' content='0'>";
}
else
{
//echo $_FILES['file']['error'];
}
}
}
?>
<script>
function myFunction()
{
//alert("This is convert botton"); // this is the message in ""
//alert(document.write("<h1>This is a heading</h1>"));
var x;
if (confirm("Press a button!") == true) {
x = "You pressed OK!";
} else {
x = "You pressed Cancel!";
}
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>