-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupload_example.html
More file actions
33 lines (29 loc) · 898 Bytes
/
upload_example.html
File metadata and controls
33 lines (29 loc) · 898 Bytes
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
31
32
33
<script>
const form = document.getElementById('form');
const inputFile = document.getElementById('file');
const formData = new FormData();
const handleSubmit = (event) => {
event.preventDefault();
for (const file of inputFile.files) {
formData.append('images', file);
}
fetch('http://13.209.200.101/board', {
method: 'post',
body: formData,
}).catch((error) => ('Something went wrong!', error));
};
form.addEventListener('submit', handleSubmit);
</script>
<body>
<div class="container">
<h1>Multipart File Upload</h1>
<form id="form" enctype="multipart/form-data">
<div class="input-group">
<label for="files">Select files</label>
<input id="file" type="file" multiple />
</div>
<button class="submit-btn" type="submit">Upload</button>
</form>
</div>
<script src="index.js"></script>
</body>