mirror of
https://github.com/Theodor-Springmann-Stiftung/hamann-ausgabe-core.git
synced 2025-10-30 01:35:32 +00:00
Crated basic file upload method; also included appsettings and feauture-management
This commit is contained in:
0
HaWeb/Views/Admin/Index.cshtml
Normal file
0
HaWeb/Views/Admin/Index.cshtml
Normal file
57
HaWeb/Views/Admin/Upload/Index.cshtml
Normal file
57
HaWeb/Views/Admin/Upload/Index.cshtml
Normal file
@@ -0,0 +1,57 @@
|
||||
Hello from Upload Index!
|
||||
|
||||
<form id="uploadForm" action="Upload" method="post"
|
||||
enctype="multipart/form-data" onsubmit="AJAXSubmit(this);return false;">
|
||||
<dl>
|
||||
<dt>
|
||||
<label for="file">File</label>
|
||||
</dt>
|
||||
<dd>
|
||||
<input id="file" type="file" name="file" />
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<input class="btn" type="submit" value="Upload" />
|
||||
|
||||
<div style="margin-top:15px">
|
||||
<output form="uploadForm" name="result"></output>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts {
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"
|
||||
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
|
||||
asp-fallback-test="window.jQuery"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=">
|
||||
</script>
|
||||
|
||||
<script>
|
||||
"use strict";
|
||||
|
||||
async function AJAXSubmit (oFormElement) {
|
||||
const formData = new FormData(oFormElement);
|
||||
|
||||
try {
|
||||
const response = await fetch(oFormElement.action, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'RequestVerificationToken': getCookie('RequestVerificationToken')
|
||||
},
|
||||
body: formData
|
||||
});
|
||||
|
||||
oFormElement.elements.namedItem("result").value =
|
||||
'Result: ' + response.status + ' ' + response.statusText;
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
}
|
||||
}
|
||||
|
||||
function getCookie(name) {
|
||||
var value = "; " + document.cookie;
|
||||
var parts = value.split("; " + name + "=");
|
||||
if (parts.length == 2) return parts.pop().split(";").shift();
|
||||
}
|
||||
</script>
|
||||
}
|
||||
@@ -45,6 +45,8 @@
|
||||
<environment exclude="Development">
|
||||
@await Html.PartialAsync("/Views/Shared/_Javascript.cshtml")
|
||||
</environment>
|
||||
|
||||
@RenderSection("Scripts", required: false)
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user