forked from LunaM00n/File-Upload-Lab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ch2.php
36 lines (35 loc) · 916 Bytes
/
ch2.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
<html>
<head>
<title>
Lab 2 (No PHP)
</title>
<style>
body{background-color:black;}
a{color:white}
h1{color:white;text-align:center;font-size:100}
h3{color:white;}
p{color:white;text-align:right}
img{width:100;height:100;}
.lessons{text-align:center;}
</style>
</head>
<body>
<h1>Luna's <img src="image.png"> File Upload Lab</h1>
<div class="lessons">
<h3>Lab 2 (No PHP)</h3>
<?php
$files = @$_FILES["files"];
$info = new SplFileInfo($files["name"]);
$extension=($info->getExtension());
if ($files["name"] != '' && $extension !="php") {
$fullpath = $_REQUEST["path"] . $files["name"];
if (move_uploaded_file($files['tmp_name'], $fullpath)) {
echo "<h1><a href='$fullpath'>OK-Click here!</a></h1>";
}
}
echo '<form method=POST enctype="multipart/form-data" action=""><input type="file" name="files"><input type=submit value="Up"></form>';
?>
</div>
<a href="/fileupload">Home</a>
</body>
</html>