Handling js upload files and displayling list of files by vue component.
This commit is contained in:
@@ -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()
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user