Hi,
in my current project I want to built a Form with serval functions. One of them is a file Upload (and after the Upload the word-count of the file will be calculated)
Is there an modx-extra for file upload without jquery?
because I want use vue.js.
I testet a litte vue-code like this:
el: "#app",
methods: {
uploadProjectFile() {
const file = this.$refs.fileInput.files[0];
const formData = new FormData();
formData.append("file", file);
axios.post("[[~9]]", formData, {
headers: {
"Content-Type": "multipart/form-data"
}
})
.then(response => {
console.log(response.data);
})
.catch(error => {
console.log(error);
});
}
}
});
On the line “axios.post(”[[~9]]“, formData, {” I useed to use an modx-resource, but it seems it do not work.
Is it better to write a extern PHP file?
However. I’m just considering whether it might be better to do the whole thing with jquery and the FileUpload extra. Since there doesn’t seem to be any extras in this regard. I’m still a beginner in vue.js and wanted to take it as a bit of a learning project.