aboutsummaryrefslogtreecommitdiff
path: root/templates/upload.html.j2
blob: 35673b7dc3120d03ab2354cf99c4230ffc2cab46 (plain)
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
{% set prefix_s = prefix | trim('/') ~ '/' %}{% set s_prefix_s = ( '/' ~ prefix | trim('/') ~ '/' ) | replace ("//","/") %}{% set ulp_s = ulp | trim('/') ~ '/' %}{% set server_prefix = ( server | replace("//","##") ~ '/' ~ prefix ~ '/' ) | replace("///","/") | replace("//", "/") | replace("##","//") %}{% set prefix_ulp = ( '/' ~ prefix ~ '/' ~ ulp ~ '/' ) | replace("///","/") | replace("//", "/") %}{% set server_prefix_ulp = ( server | replace("//","##") ~ '/' ~ prefix ~ '/' ~ ulp ~ '/' ) | replace("///","/") | replace("//", "/") | replace("##","//") %}<!DOCTYPE html>
<html>
  <head>
    <title>
      FUSS upload page
    </title>
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- (A) CSS + JS -->
    <link rel="stylesheet" href="{{ s_prefix_s }}static/upload.css"/>
    <link rel="stylesheet" href="{{ s_prefix_s }}static/index.css"/>
    <script src="{{ s_prefix_s }}template/upload.js"></script>
    <script>
        function lastmod(elem){
            tc = "lastmod=";
            for (var x=0; x < elem.files.length; x++) {
                tc += `${Math.trunc(elem.files[x].lastModified / 1000)},`
            }
            document.cookie = tc;
            // For a single file:
            //document.cookie = `lastmod=${elem.files[0].lastModified}`
        }
    </script>
  </head>
<!--
server = "{{ server }}"
prefix = "{{ prefix }}"
ulp = "{{ ulp }}"
-->
  <body>
    <!-- (B) FILE DROP ZONE -->
    <div id="upzone">
      Drop Files Here
    </div>

    <!-- (D) FALLBACK -->
    <form id="upform" action="{{ server_prefix_ulp }}" method="post" enctype="multipart/form-data">
      <br/>
      <input type="file" name="file" multiple accept="*" oninput="lastmod(this);" required>
      <input type="submit" value="Upload File">
    </form>

    <!-- (C) UPLOAD STATUS -->
    <div id="hiddenfirst">
        <input id="upstatus" class="toggle" type="checkbox" checked><label for="upstatus" class="lbl-toggle" tabindex="0">Upload status</label>
        <div id="upstatus" class="content">
        <div class="content-inner" id="upstat">
        </div> <!-- content-inner -->
        </div> <!-- content -->
    </div>
    <script src="{{ s_prefix_s }}static/index.js"></script>
  </body>
</html>
bgstack15