Skip to content

Commit a5fa05b

Browse files
author
Bony Emmanuel
authored
Add files via upload
1 parent eedba7e commit a5fa05b

31 files changed

+680
-156
lines changed

changelog.html

+8
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
<br />
1616
<b>Changelog:</b>
1717
<br/><br/>
18+
19+
<b>V1.2.3</b>
20+
<ul>
21+
<li>Added and option to prevent file deletion by users. <br />Admin can turn on this option from the server</li>
22+
<li>Clients can see there IP address in stat page</li>
23+
</ul>
24+
<br />
25+
1826
<b>V1.2.2</b>
1927
<ul>
2028
<li>Added changelogs page</li>

del.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
$typ = $_GET['t'];
44
unlink($loc);
55
header("Location: type.php?typ=$typ");
6-
?>
6+
?>

index.php

+88-64
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,89 @@
1+
<!DOCTYPE html>
12
<html>
2-
<head>
3-
<link rel='stylesheet' href='src/css/main.css'>
4-
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
5-
<link rel='stylesheet' href='src/css/responsive.css' media='screen and (max-width:900px)'>
6-
<title>File Server | Home</title>
7-
<head>
8-
<body>
9-
<div class='topNav'>
10-
<div class='aboutTxt'>
11-
File Server
12-
</div>
13-
<a href='stat.php'>
14-
<div class='statLogo right'>
15-
<img src='src/img/stat.png' width='32px' title='Server Status' alt='Server Status'>
16-
</div>
17-
</a>
18-
<div class='infoTxt' title='Storage used'>
19-
<?php
20-
function folderSize ($dir){
21-
$size = 0;
22-
foreach (glob(rtrim($dir, '/').'/*', GLOB_NOSORT) as $each) {
23-
$size += is_file($each) ? filesize($each) : folderSize($each);
24-
}
25-
return $size;
26-
}
27-
$dirSize = (folderSize("uploads/")/1024)/1024;
28-
if($dirSize<1024){
29-
$precision = 2;
30-
$dirSize = substr(number_format($dirSize, $precision+1, '.', ''), 0, -1);
31-
echo $dirSize. "MB";
32-
}
33-
else{
34-
$precision = 2;
35-
$dirSize = $dirSize/1024;
36-
$dirSize = substr(number_format($dirSize, $precision+1, '.', ''), 0, -1);
37-
echo $dirSize. "GB";
38-
}
39-
?>
40-
</div>
41-
</div>
42-
<br />
43-
<div class='mainBody'>
44-
<div class='uploadBox'>
45-
<form action='upload.php' method='post' enctype='multipart/form-data'>
46-
<input type='file' name='file'>
47-
<input type='submit' value='Upload' class='uploadBtn'>
48-
</form>
49-
</div>
50-
<br />
51-
<a href='type.php?typ=1'>
52-
<div class='typeBox card' style='background:#D32F2F;'><div class='typeTxt'>Images</div></div>
53-
</a>
54-
<a href='type.php?typ=2'>
55-
<div class='typeBox card' style='background:#6A1B9A;'><div class='typeTxt'>Videos</div></div>
56-
</a>
57-
<a href='type.php?typ=3'>
58-
<div class='typeBox card' style='background:#1565C0;'><div class='typeTxt'>Audios</div></div>
59-
</a>
60-
<a href='type.php?typ=4'>
61-
<div class='typeBox card' style='background:#FFB300;'><div class='typeTxt'>Others</div></div>
62-
</a>
63-
</div>
64-
</body>
65-
<html>
3+
<link rel="shortcut icon" type="image/png" href="https://material.io/icons/static/images/icons-180x180.png">
4+
<meta name="theme-color" content="#111">
5+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
6+
<head>
7+
<title>FileServer</title>
8+
<link rel="stylesheet" href="src/css/index.css">
9+
<script type="text/javascript" src="src/script/script.js"></script>
10+
</head>
11+
<body id="body">
12+
<div class="topbar shadowDeep">
13+
FileServer
14+
<div class="rightPanel">
15+
<?php
16+
function folderSize ($dir){
17+
$size = 0;
18+
foreach (glob(rtrim($dir, '/').'/*', GLOB_NOSORT) as $each) {
19+
$size += is_file($each) ? filesize($each) : folderSize($each);
20+
}
21+
return $size;
22+
}
23+
$dirSize = (folderSize("uploads/")/1024)/1024;
24+
if($dirSize<1024){
25+
$precision = 2;
26+
$dirSize = substr(number_format($dirSize, $precision+1, '.', ''), 0, -1);
27+
echo $dirSize." MB";
28+
}
29+
else{
30+
$precision = 2;
31+
$dirSize = $dirSize/1024;
32+
$dirSize = substr(number_format($dirSize, $precision+1, '.', ''), 0, -1);
33+
echo $dirSize." GB";
34+
}
35+
?>
36+
<a href="stat.php">
37+
<div class="statIconHolder shadowDeep"><img src="src/img/stat.png" alt="Server Status" class="statImg"></div>
38+
</a>
39+
</div>
40+
</div>
41+
<div class="main">
42+
<div class="uploadHolder">
43+
<div id="uploadLaunchButton" class="shadowDeep" onclick="showuploadBox()">Upload</div>
44+
<!--uploadBox-->
45+
<div class="inContainer" id="inContainer">
46+
<div style="display:none;" id="lcarte">
47+
<div class="closeBtn shadow" onclick="hideuploadBox()"></div>
48+
<br>Select items to upload..<br><br>
49+
<form action="uploadMul.php" enctype="multipart/form-data" method="post" name="uploadForm">
50+
<input type="text" name="inputBox" class="uploadSelector shadow" onclick="clickOnBrowse()">
51+
<div class="uploadSelectorSideDiv shadow" onclick="clickOnBrowse()">Browze </div>
52+
<input id='upload' name="upload[]" type="file" multiple="multiple" onChange="makeFileList();" style="display:none;"/>
53+
<div class="submitBtnHolder"><input type="submit" class="uploadBtn shadow" name="submit" value="Submit">
54+
</form>
55+
<ul id="fileList">
56+
No Files Selected
57+
</ul>
58+
</div>
59+
</div>
60+
</div>
61+
</div>
62+
<!--items------------>
63+
<a href='type.php?typ=1'>
64+
<div class="pieceHolder shadow">
65+
<div class="pieceHolder-image" style="background:url('src/img/images.jpg') center/cover"></div>
66+
<div class="pieceHolder-text">Images</div>
67+
</div>
68+
</a>
69+
<a href='type.php?typ=2'>
70+
<div class="pieceHolder shadow">
71+
<div class="pieceHolder-image" style="background:url('src/img/videos.png') center/cover"></div>
72+
<div class="pieceHolder-text">Videos</div>
73+
</div>
74+
</a>
75+
<a href='type.php?typ=3'>
76+
<div class="pieceHolder shadow">
77+
<div class="pieceHolder-image" style="background:url('src/img/audios.jpg') center/cover"></div>
78+
<div class="pieceHolder-text">Audios</div>
79+
</div>
80+
</a>
81+
<a href='type.php?typ=4'>
82+
<div class="pieceHolder shadow">
83+
<div class="pieceHolder-image" style="background:url('src/img/others.png') center/cover"></div>
84+
<div class="pieceHolder-text">Others</div>
85+
</div>
86+
</a>
87+
</div>
88+
</body>
89+
</html>

readme-whatIsNew.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
uploadMul.php is the php code to upload multiple files to the dir/ without catagorising them.
2+
Only the layout of index page is changed.

src/css/index.css

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
2+
@media (min-width:960px){
3+
body{width:100%;font-family:"calibri light",calibri,arial;font-weight:100;margin:0px;background:#fff;overflow-x:hidden;}
4+
a{color:#c8c8c8;text-decoration:none;outline:none;cursor:pointer;}
5+
input{outline:none;}
6+
li{list-style-type:none;}
7+
.topbar{width:100%;position:fixed;background:#3f51b5;padding:18px;color:#fff;font-size:18px;}
8+
.shadow{box-shadow:0 2px 2px rgba(0,0,0,0.5);transition:0.2s;}
9+
.shadowDeep{box-shadow:1px 2px 1px rgba(0,0,0,0.5);color:#fff;transition:0.2s;}
10+
.rightPanel{float:right;margin-right:40px;font-size:16px;}
11+
.statIconHolder{position:fixed;top:7%;border-radius: 100%;background:#c0e2ff;width:50px;height:50px;}
12+
.statImg{height:50px;width:50px;cursor:pointer;}
13+
.main{width:70%;margin:auto;padding-top:10%;}
14+
.uploadHolder{width:100%;margin-bottom:30px;}
15+
#uploadLaunchButton{padding:20px;padding-top:10px;padding-bottom:10px;border-radius:20px;background:#3f51b5;width:60px;font-size:17px;color:#fff;}
16+
#uploadLaunchButton:hover{transition:0.3s;cursor:pointer;background:#243393;}
17+
.inContainer{width:60%;height:auto;padding:0px;transition:0.1s;opacity:0;}
18+
.inContainer_later{width:60%;transition:0.3s;padding:20px;color:#555;opacity:1;background:#fff;}
19+
.uploadSelector{padding-left:6px;height:36px;width:70%;border:1px solid #e0e0e0;float:left;color:#444;cursor: pointer;}
20+
.uploadSelectorSideDiv{float:left;background:#4285f4;height:29px;width:20%;text-align:center;color:#fff;cursor: pointer;font-family: arial;padding-top:11px;}
21+
.uploadBtn{background:#e0e0e0;border:0px;height:40px;cursor: pointer;width:100px;color:#666;margin-top:20px;}
22+
#fileList{font-size:15px;color:#444;font-family:arial;padding-top:10px;line-height:1.2;padding-left:2px;}
23+
.closeBtn{height:16px;width:16px;background:#ea4335;float:right;border-radius: 100%;cursor:pointer;}
24+
.pieceHolder{background:#fff;width:22%;height:200px;float:left;margin-right:3%;cursor:pointer;border-radius:2px;}
25+
.pieceHolder-image{width:100%;height:150px;border-top-left-radius:2px;border-top-right-radius:2px;}
26+
.pieceHolder-text{padding:10px;padding-top:12px;font-size:20px;color:#555;}
27+
}
28+
29+
@media (min-width:600px) and (max-width:959px){
30+
body{width:100%;font-family:calibri light,calibri,arial;font-weight:100;margin:0px;background:#fff;overflow-x:hidden;}
31+
a{color:#c8c8c8;text-decoration:none;outline:none;cursor:pointer;}
32+
input{outline:none;}
33+
li{list-style-type:none;}
34+
.topbar{width:100%;position:fixed;background:#3f51b5;padding:17px;font-size:18px;}
35+
.shadow{box-shadow:0 2px 2px rgba(0,0,0,0.3);color:#fff;}
36+
.shadowDeep{box-shadow:0 4px 4px rgba(0,0,0,0.4);color:#fff;}
37+
.rightPanel{float:right;margin-right:40px;font-size:16px;padding-top:3px;}
38+
.statIconHolder{position:fixed;top:8%;border-radius: 100%;background:#c0e2ff;width:45px;height:45px;}
39+
.statImg{height:45px;width:45px;cursor:pointer;}
40+
.main{width:80%;margin:auto;padding-top:14%;}
41+
.uploadHolder{width:100%;margin-bottom:30px;}
42+
#uploadLaunchButton{padding:20px;padding-top:10px;padding-bottom:10px;border-radius:20px;background:#3f51b5;width:60px;font-size:17px;color:#fff;}
43+
#uploadLaunchButton:hover{transition:0.3s;cursor:pointer;background:#243393;}
44+
.inContainer{width:75%;height:auto;padding:0px;transition:0.1s;opacity:0;}
45+
.inContainer_later{width:75%;transition:0.3s;padding:20px;color:#555;opacity:1;background:#fff;}
46+
.uploadSelector{padding-left:6px;height:36px;width:70%;border:1px solid #e0e0e0;float:left;color:#444;cursor: pointer;}
47+
.uploadSelectorSideDiv{float:left;background:#4285f4;height:29px;width:20%;text-align:center;color:#fff;cursor: pointer;font-family: arial;padding-top:11px;}
48+
.uploadBtn{background:#e0e0e0;border:0px;height:40px;cursor: pointer;width:100px;color:#666;margin-top:20px;}
49+
#fileList{font-size:15px;color:#444;font-family:arial;padding-top:10px;line-height:1.2;padding-left:2px;word-wrap:break-word;}
50+
.closeBtn{height:16px;width:16px;background:#ea4335;float:right;border-radius: 100%;cursor:pointer;}
51+
.pieceHolder{background:#fff;width:43%;height:200px;float:left;margin-right:7%;cursor:pointer;border-radius:2px;margin-bottom:50px;}
52+
.pieceHolder-image{width:100%;height:150px;border-top-left-radius:2px;border-top-right-radius:2px;}
53+
.pieceHolder-text{padding:10px;padding-top:12px;font-size:20px;color:#555;}
54+
}
55+
56+
@media only screen and (max-width:599px){
57+
body{width:100%;font-family:calibri light,calibri,arial;font-weight:100;margin:0px;background:#fff;overflow-x:hidden;}
58+
a{color:#c8c8c8;text-decoration:none;outline:none;cursor:pointer;}
59+
input{outline:none;}
60+
li{list-style-type:none;}
61+
.topbar{width:100%;position:fixed;background:#3f51b5;padding:14px;font-size:18px;}
62+
.shadow{box-shadow:0 2px 2px rgba(0,0,0,0.3);color:#fff;}
63+
.shadowDeep{box-shadow:0 2px 2px rgba(0,0,0,0.4);color:#fff;}
64+
.rightPanel{float:right;margin-right:30px;font-size:16px;padding-top:4px;}
65+
.statIconHolder{position:fixed;top:7%;border-radius:100%;background:#c0e2ff;width:38px;height:38px;}
66+
.statImg{height:38px;width:38px;cursor:pointer;float:right;}
67+
.main{width:80%;margin:auto;padding-top:28%;}
68+
.uploadHolder{width:100%;margin-bottom:30px;}
69+
#uploadLaunchButton{padding:20px;padding-top:10px;padding-bottom:10px;border-radius:20px;background:#3f51b5;width:60px;font-size:17px;color:#fff;}
70+
#uploadLaunchButton:hover{transition:0.3s;cursor:pointer;background:#243393;}
71+
.inContainer{width:90%;height:auto;padding:0px;transition:0.1s;opacity:0;}
72+
.inContainer_later{width:84%;transition:0.3s;padding:20px;color:#555;opacity:1;background:#fff;}
73+
.uploadSelector{padding-left:4px;height:36px;width:60%;font-size:14px;border:1px solid #e0e0e0;float:left;color:#444;cursor: pointer;}
74+
.uploadSelectorSideDiv{float:left;background:#4285f4;height:29px;width:30%;font-size:14px;text-align:center;color:#fff;cursor: pointer;font-family: arial;padding-top:11px;}
75+
.uploadBtn{background:#e0e0e0;border:0px;height:40px;cursor: pointer;width:100px;color:#666;margin-top:20px;}
76+
#fileList{font-size:15px;color:#444;font-family:arial;padding-top:10px;line-height:1.2;padding-left:2px;word-wrap:break-word;}
77+
.closeBtn{height:16px;width:16px;background:#ea4335;float:right;border-radius: 100%;cursor:pointer;}
78+
.pieceHolder{background:#fff;width:100%;height:200px;float:left;cursor:pointer;border-radius:2px;margin-bottom:50px;}
79+
.pieceHolder-image{width:100%;height:150px;border-top-left-radius:2px;border-top-right-radius:2px;}
80+
.pieceHolder-text{padding:10px;padding-top:12px;font-size:20px;color:#555;}
81+
}

src/css/index.php

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
header("Location:../../");
3+
?>

src/css/main.css

+5-5
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ a{
8686
margin-top: 115px;
8787
}
8888
.uploadBox{
89-
padding: 15px;
90-
min-width:100px;
89+
padding: 15px;
90+
min-width:100px;
9191
height:5px;
9292
display: inline-block
9393
margin-bottom:5px;
9494
}
9595
.delBtn{
96-
float:right;
97-
margin-top:-22px;
96+
float:right;
97+
margin-top:-22px;
9898
margin-right:5px;
9999
}
100100
.textInp{
@@ -106,4 +106,4 @@ a{
106106
.textInp:focus{
107107
outline: 0;
108108
border-bottom: 2px solid #212121;
109-
}
109+
}

src/css/stat.css

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
2+
@media (min-width:960px){
3+
body{width:100%;font-family:"calibri light",calibri,arial;font-weight:100;margin:0px;background:#fff;overflow-x:hidden;}
4+
a{color:#00a217;text-decoration:none;outline:none;cursor:pointer;}
5+
input{outline:none;}
6+
.shadow{box-shadow:0 2px 2px rgba(0,0,0,0.5);transition:0.2s;}
7+
.rightPanel{float:right;margin-right:40px;}
8+
.main{width:70%;margin:auto;padding-top:7%;}
9+
.leftPart{width:64%;float:left;}
10+
.matterHolder{background:#fff;color:#555;font-size:18px;padding:20px;}
11+
.title-in{font-size:24px;color:#4285f4;}
12+
.textInp{width:70%;padding-left:6px;height:36px;border:0px;border-bottom:2px solid #4a92ff;float:left;color:#444;}
13+
.shadowLight{box-shadow:0 1px 2px rgba(0,0,0,0.3);}
14+
.setButton{width:28%;border:0px;background:#bcbcbc;padding:9px;cursor:pointer;border-bottom:2px solid #4a92ff;}
15+
.deleteOption{background:#e0e0e0;color:#555;font-size:18px;padding:20px;}
16+
.rightPart{width:30%;margin-left:5%;float:left;}
17+
.inRightPart{background:rgba(0,0,0,0.6);height:170px;color:#fff;}
18+
.simpleImg{background:url('src/img/update.gif') center/cover;padding:0px;}
19+
.checkUpdate{width:80%;padding:16px;border-radius:20px;}
20+
.whiteLink{color:#fff;}
21+
.setRuleBtn{padding:8px;border:0px;color:#fff;border-radius: 2px;cursor: pointer;}
22+
.disable{background:#ea4335;}
23+
.enable{background:#4285f4;}
24+
#uploadLaunchButton{padding:20px;transition:0.3s;padding-top:10px;padding-bottom:10px;margin-bottom:30px;border-radius:20px;background:#4285f4;width:40px;font-size:17px;color:#fff;}
25+
#uploadLaunchButton:hover{transition:0.3s;cursor:pointer;background:#999;}
26+
}
27+
28+
@media (min-width:600px) and (max-width:959px){
29+
body{width:100%;font-family:"calibri light",calibri,arial;font-weight:100;margin:0px;background:#fff;overflow-x:hidden;}
30+
a{color:#00a217;text-decoration:none;outline:none;cursor:pointer;}
31+
input{outline:none;}
32+
.shadow{box-shadow:0 2px 2px rgba(0,0,0,0.5);transition:0.2s;}
33+
.rightPanel{float:right;margin-right:20px;}
34+
.main{width:90%;margin:auto;padding-top:7%;}
35+
.leftPart{width:64%;float:left;}
36+
.matterHolder{background:#fff;color:#555;font-size:16px;padding:16px;}
37+
.title-in{font-size:24px;color:#4285f4;}
38+
.textInp{width:69%;padding-left:6px;height:36px;border:0px;border-bottom:2px solid #4a92ff;float:left;color:#444;}
39+
.shadowLight{box-shadow:0 1px 2px rgba(0,0,0,0.3);}
40+
.setButton{width:28%;border:0px;background:#bcbcbc;padding:9px;cursor:pointer;border-bottom:2px solid #4a92ff;}
41+
.deleteOption{background:#e0e0e0;color:#555;font-size:16px;padding:16px;}
42+
.rightPart{width:30%;margin-left:5%;float:left;}
43+
.inRightPart{background:rgba(0,0,0,0.6);height:170px;color:#fff;}
44+
.simpleImg{background:url('src/img/update.gif') center/cover;padding:0px;}
45+
.checkUpdate{width:80%;padding:16px;border-radius:20px;}
46+
.whiteLink{color:#fff;}
47+
.setRuleBtn{padding:8px;border:0px;color:#fff;border-radius: 2px;cursor: pointer;}
48+
.disable{background:#ea4335;}
49+
.enable{background:#4285f4;}
50+
#uploadLaunchButton{padding:20px;padding-top:10px;padding-bottom:10px;border-radius:20px;background:#3f51b5;width:60px;font-size:17px;color:#fff;}
51+
#uploadLaunchButton:hover{transition:0.3s;cursor:pointer;background:#243393;}
52+
}
53+
54+
@media only screen and (max-width:599px){
55+
body{width:100%;font-family:"calibri light",calibri,arial;font-weight:200;margin:0px;background:#fff;overflow-x:hidden;}
56+
a{color:#00a217;text-decoration:none;outline:none;cursor:pointer;}
57+
input{outline:none;}
58+
.shadow{box-shadow:0 2px 2px rgba(0,0,0,0.5);transition:0.2s;}
59+
.rightPanel{float:right;margin-right:20px;}
60+
.main{width:90%;margin:auto;padding-top:7%;}
61+
.leftPart{width:100%;float:left;}
62+
.matterHolder{background:#fff;color:#000;font-size:16px;padding:16px;}
63+
.title-in{font-size:24px;color:#4285f4;}
64+
.textInp{width:98%;padding-left:6px;height:36px;border:0px;border-bottom:2px solid #4a92ff;float:left;color:#444;}
65+
.shadowLight{box-shadow:0 1px 2px rgba(0,0,0,0.3);}
66+
.setButton{width:28%;border:0px;background:#bcbcbc;margin-top:10px;padding:10px;cursor:pointer;}
67+
.deleteOption{background:#e0e0e0;color:#555;font-size:16px;padding:16px;}
68+
.rightPart{width:100%;margin-top:7%;margin-bottom:10%;float:left;clear:left;}
69+
.inRightPart{background:rgba(0,0,0,0.6);height:170px;color:#fff;}
70+
.simpleImg{background:url('src/img/update.gif') center/cover;padding:0px;}
71+
.checkUpdate{width:80%;padding:16px;border-radius:20px;}
72+
.whiteLink{color:#fff;}
73+
.setRuleBtn{padding:8px;border:0px;color:#fff;border-radius: 2px;cursor: pointer;}
74+
.disable{background:#ea4335;}
75+
.enable{background:#4285f4;}
76+
}

0 commit comments

Comments
 (0)