nirvash/templates/file_upload.html

32 lines
941 B
HTML
Raw Normal View History

2022-06-13 06:32:14 +00:00
{{ $slug := ((.Context).Value "params").Slug }}
{{ $csrfToken := (.Context).Value "csrfToken" }}
{{ $fileListing := ((.Context).Value "file-manager").ListSubtree $slug }}
2022-06-13 06:32:14 +00:00
{{ template "header" . }}
{{ if ($fileListing).Error }}
<h2>Error</h2>
<span class="adapter-error">{{($fileListing).Error}}</span>
{{ else }}
2022-06-13 06:32:14 +00:00
<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>
2022-06-13 06:32:14 +00:00
<input type="submit" value="Upload"/>
</form>
{{ end }}
{{ template "footer" . }}