-
Notifications
You must be signed in to change notification settings - Fork 1
/
upload.html
58 lines (56 loc) · 1.61 KB
/
upload.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
<!DOCTYPE html>
<html>
<head>
<title>DropLink</title>
<link rel="stylesheet" type="text/css" href="../media/normalize-and-grid.css">
<style type="text/css">
div.uploaded-message {
padding: 20px;
}
.linktocopy {
border: 1px solid #AAA;
margin: 10px;
font-family: monospace;
overflow: scroll;
}
</style>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-sm-offset-2 col-sm-8 col-md-offset-3 col-md-6 col-lg-offset-4 col-lg-4">
{{if .DownloadURL}}
<div class="uploaded-message">
<p><strong>Uploaded:</strong></p>
<div class="linktocopy">{{.DownloadURL}}</div>
<p>Short URL:</p>
<div class="linktocopy">{{.ShortURL}}</div>
</div>
{{end}}
<h1>Upload a file</h1>
<form action="" method="POST" enctype="multipart/form-data" id="uploadForm">
<input type="file" name="file" />
<input type="submit" value="Upload" />
</form>
</div>
</div>
</div>
<script>
document.getElementsByName("file")[0].onchange = function() {
document.getElementById('uploadForm').submit()
}
document.querySelector('input[type=submit]').style.display = 'none';
(function() {
var urls = document.querySelectorAll('.linktocopy')
for(var i = 0; i < urls.length; ++i) {
var url = urls.item(i);
url.onclick = function() {
var range = document.createRange();
range.selectNode(url);
window.getSelection().addRange(range);
}
}
})()
</script>
</body>
</html>