diff --git a/src/views/Delegate/Gallery.vue b/src/views/Delegate/Gallery.vue index 4d7c956..e0ce671 100644 --- a/src/views/Delegate/Gallery.vue +++ b/src/views/Delegate/Gallery.vue @@ -262,7 +262,11 @@ export default { const reader = new FileReader() reader.readAsArrayBuffer(file) reader.onloadend = (event) => { - resolve(['file', event.target.result, file.name]) + let name = file.name + if (file.type.indexOf('video') !== -1) { + name += '||%_FORMAT_VIDEO_%||' // it's a dirty way to say to the back end : 'hey this is a video file !' + } + resolve(['file', event.target.result, name]) } reader.onerror = () => { console.log(reader.error) @@ -275,7 +279,11 @@ export default { const promises = this.files.map(file => this.loadFile(file)) Promise.all(promises).then(results => { const formData = new FormData() - results.forEach(r => formData.append(r[0], new Blob([new Uint8Array(r[1])]), r[2])) + results.forEach(r => formData.append( + r[0], // field name + new Blob([new Uint8Array(r[1])]), // the file + r[2] // file name + )) this.$apitator.post('/delegate/medias', formData, { withAuth: true,