Handling js upload files and displayling list of files by vue component.

This commit is contained in:
krzysiej
2022-06-01 14:56:56 +02:00
parent 26bd59f3bb
commit 1a5445a84a
7 changed files with 69 additions and 41 deletions

View File

@@ -30,10 +30,14 @@ export default class extends Controller {
_onChange(event) {
// The dropzone just changed
console.info(event);
console.info('onchange');
event.target.closest('form').submit();
axios.post(document.URL, new FormData(event.target.closest('form')), {
headers: {
'Content-Type': 'multipart/form-data'
}
}).then(() => {
event.target.querySelector('.dropzone-preview-button').click()
})
}