-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
54 lines (54 loc) · 1.79 KB
/
index.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
<!doctype html>
<html>
<head>
<title>up</title>
<style>
fieldset {
margin: 20px 0;
}
.container {
width: 800px;
}
#url {
box-sizing: border-box;
width: 100%;
}
</style>
</head>
<body>
<div class="container">
{{#url}}
<p id="message">
Upload successful. <label for="url">URL:</label><br>
<input id="url" readonly value="{{{url}}}">
</p>
{{/url}}
<form action="https://{{bucket}}.objects-us-east-1.dream.io" method="post" enctype="multipart/form-data" name="uploadForm">
<fieldset>
<legend>Upload</legend>
<input type="hidden" name="key" value="">
<input type="hidden" name="AWSAccessKeyId" value="{{accessKey}}">
<input type="hidden" name="acl" value="{{acl}}">
<input type="hidden" name="success_action_redirect" value="{{{successActionRedirect}}}">
<input type="hidden" name="policy" value="{{{policy}}}">
<input type="hidden" name="signature" value="{{{signature}}}">
<input type="hidden" name="Content-Type" value="">
<p><input type="file" name="file" id="file"></p>
<p><input type="submit"></p>
</fieldset>
</form>
</div>
<script>
// test 2017-04-18, 3
// Guess the mimetype and update the Content-Type
// Inspired from http://jsbin.com/akati3/2
var file = document.getElementById('file');
var uploadForm = document.forms["uploadForm"];
var sanitizeRe = /[^\w\-\.]/g;
file.addEventListener('change', function() {
uploadForm["Content-Type"].value = file.files[0].type;
uploadForm["key"].value = "{{path}}/" + file.files[0].name.replace(sanitizeRe, '_');
}, false);
</script>
</body>
</html>