nirvash/templates/file_upload.html

31 lines
941 B
HTML

{{ $slug := ((.Context).Value "params").Slug }}
{{ $csrfToken := (.Context).Value "csrfToken" }}
{{ $fileListing := ((.Context).Value "file-manager").ListSubtree $slug }}
{{ template "header" . }}
{{ if ($fileListing).Error }}
<h2>Error</h2>
<span class="adapter-error">{{($fileListing).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" . }}