This commit is contained in:
j3d1 2023-07-05 00:59:50 +02:00
parent e2cf04cf18
commit f7c9d1d069

View file

@ -8,7 +8,7 @@
<ul> <ul>
<img v-for="file in files" :key="file.id" :src="file.name" :alt="file.name" class="img-thumbnail"> <img v-for="file in files" :key="file.id" :src="file.name" :alt="file.name" class="img-thumbnail">
</ul> </ul>
<legend>Files</legend> <h4>Files</h4>
<div class="input-group"> <div class="input-group">
<input type="file" class="form-control" multiple id="files"> <input type="file" class="form-control" multiple id="files">
<button class="btn btn-outline-secondary" type="button"> <button class="btn btn-outline-secondary" type="button">
@ -19,7 +19,7 @@
</button> </button>
</div> </div>
<div class="input-group" v-if="show_camera"> <div class="input-group" v-if="show_camera">
<input type="file" class="form-control" accept="image/*" capture="camera" id="photos"> <input type="file" class="form-control" accept="image/*" multiple capture="camera" id="photos">
<button class="btn btn-outline-secondary" type="button"> <button class="btn btn-outline-secondary" type="button">
<b-icon-trash></b-icon-trash> <b-icon-trash></b-icon-trash>
</button> </button>
@ -68,7 +68,6 @@ export default {
methods: { methods: {
...mapActions(["fetchFiles", "pushFile"]), ...mapActions(["fetchFiles", "pushFile"]),
async uploadFiles() { async uploadFiles() {
//const formData = new FormData();
const files = document.getElementById("files").files; const files = document.getElementById("files").files;
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
var reader = new FileReader(); var reader = new FileReader();
@ -96,10 +95,8 @@ export default {
}); });
await this.fetchFiles(); await this.fetchFiles();
} }
//console.log("formData", formData);
}, },
async uploadPhoto() { async uploadPhoto() {
//const formData = new FormData();
const files = document.getElementById("photos").files; const files = document.getElementById("photos").files;
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
var reader = new FileReader(); var reader = new FileReader();
@ -127,7 +124,6 @@ export default {
}); });
await this.fetchFiles(); await this.fetchFiles();
} }
//console.log("formData", formData);
}, },
}, },
mounted() { mounted() {