all repos — nirvash @ main

modular CMS using the quartzgun library

templates/file_upload.html (raw)

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
{{ $slug := ((.Context).Value "params").Slug }}
{{ $csrfToken := (.Context).Value "csrfToken" }}
{{ $fileData := ((.Context).Value "file-manager").GetFileData $slug }}

{{ template "header" . }}

{{ if ($fileData).Error }}

<h2>Filesystem Error</h2>
<span class="adapter-error">{{($fileData).Error}}</span>

{{ else }}
<h2>File Upload</h2>

<form class="uploader" enctype="multipart/form-data" method="POST" action="/upload-process/{{$slug}}">
<input hidden type="text" name="csrfToken" value="{{$csrfToken}}"/>

  <span>Uploading file to /{{$slug}}</span><br/>
  <span class="upload-warning">(file with the same name as your upload will be overwritten!)</span><br/>
  <div class="upload-wrapper">
  <label for="file-upload">Select File</label><br/>
  <input required type="file" id="file-upload" name="file"/>
  <div class="file-feedback"></div>
  </div>
  <input type="submit" value="Upload"/>
</form>

{{ end }}

{{ template "footer" . }}