const handleUploadPhoto = async e => {
e.preventDefault();
const formData = new FormData();
let files = e.dataTransfer.files
if (!files.length) {
return false
}
forEach(files, (value, index) => {
formData.append('files[]',value)
}
const { data } = await axios.post("/api/upload", formData, {
headers: {
"Content-Type": "multipart/form-data"
}
})
.then(response => {
console.log(data);
});
};
вот пример