-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdrag-drop-file-uploader.html
134 lines (119 loc) · 2.69 KB
/
drag-drop-file-uploader.html
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="robots" content="index, follow">
<meta name="author" content="Tuber Boy">
<title>Drag & Drop File Uploader Using Pure CSS</title>
<meta name="msapplication-TileColor" content="#786fff">
<meta name="theme-color" content="#786fff">
<style>
* {
box-sizing: border-box;
font-family: 'Lato', sans-serif;
}
body {
margin: 0;
padding: 0;
font-weight: 300;
height: 100%;
color: #fff;
font-size: 16px;
overflow: hidden;
}
.file-area {
background: #053777;
width: 50%;
position: relative;
margin: 0 auto;
display: flex;
flex-direction: column;
justify-content: center;
height: 300px;
}
.file-area input[type=file] {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
right: 0;
bottom: 0;
opacity: 0;
cursor: pointer;
}
.file-area .file-dummy {
width: 100%;
padding: 20px;
background: rgba(255, 255, 255, 0.2);
border: 2px dashed #ffffff;
text-align: center;
transition: background 0.3s ease-in-out;
}
.file-area .file-dummy .success {
display: none;
}
.file-area:hover .file-dummy {
background: rgba(255, 255, 255, 0.1);
}
.file-area input[type=file]:valid+.file-dummy {
border-color: rgba(0, 255, 0, 0.4);
background-color: rgba(0, 255, 0, 0.3);
}
.file-area input[type=file]:valid+.file-dummy .success {
display: inline-block;
padding: 50px;
}
.file-area input[type=file]:valid+.file-dummy .default {
display: none;
}
.icon {
font-size: 100px;
color: #fff;
}
header {
font-size: 30px;
font-weight: 500;
color: #fff;
}
span {
font-size: 25px;
font-weight: 500;
color: #fff;
}
button {
padding: 10px 25px;
font-size: 20px;
font-weight: 500;
border: none;
outline: none;
color: #5256ad;
border-radius: 5px;
cursor: pointer;
}
@media only screen and (max-width: 600px) {
.file-area {
width: 100%;
}
}
</style>
</head>
<body>
<form action method="post">
<div class="form-group file-area">
<input type="file" name="images" id="images" required="required" multiple="multiple" />
<div class="file-dummy">
<div class="success">File Added Successfully!</div>
<div class="default">
Built in Pure CSS
<div class="icon">📁⬆️</div>
<header>Drag & Drop to Upload File</header>
<span>OR</span>
<button>Browse File</button>
</div>
</div>
</div>
</form>
</body>
</html>