2022-08-01 04:53:29 +02:00
|
|
|
<!-- TODO: fix me -->
|
|
|
|
|
2022-08-01 02:17:59 +02:00
|
|
|
<html>
|
2022-08-01 04:53:29 +02:00
|
|
|
<head><title>S3 Upload Test</title></head>
|
|
|
|
<body>
|
|
|
|
<form target="/" method="post" enctype="multipart/form-data" id="s3UploadForm">
|
|
|
|
<label>
|
|
|
|
Namespace:
|
|
|
|
<input type="text" name="namespace" value="default" />
|
|
|
|
</label>
|
|
|
|
<input type="file" multiple name="file" />
|
|
|
|
<input type="button" value="Submit" onclick="upload()"></button>
|
|
|
|
</form>
|
|
|
|
|
2022-08-01 02:17:59 +02:00
|
|
|
<script>
|
2022-08-01 04:53:29 +02:00
|
|
|
async function upload() {
|
|
|
|
var $form = document.getElementById('s3UploadForm');
|
|
|
|
var $files = document.getElementsByName('file')[0];
|
2022-08-01 02:17:59 +02:00
|
|
|
|
2022-08-01 04:53:29 +02:00
|
|
|
const formData = new FormData();
|
2022-08-01 02:17:59 +02:00
|
|
|
|
2023-02-26 22:56:55 +01:00
|
|
|
formData.append("namespace", $form.namespace.value);
|
2022-08-01 02:17:59 +02:00
|
|
|
|
2022-08-01 04:53:29 +02:00
|
|
|
for (const file in $files.files) {
|
|
|
|
formData.append("file", file);
|
|
|
|
}
|
2022-08-01 02:17:59 +02:00
|
|
|
|
2022-08-01 04:53:29 +02:00
|
|
|
await fetch(new URL(window.location), {
|
|
|
|
method: 'POST',
|
|
|
|
formData
|
|
|
|
});
|
|
|
|
}
|
2022-08-01 02:17:59 +02:00
|
|
|
</script>
|
2022-08-01 04:53:29 +02:00
|
|
|
</body>
|
2022-08-01 02:17:59 +02:00
|
|
|
</html>
|