Created
December 12, 2021 01:16
-
-
Save eufelipemateus/59ad8532d00c4079acaba3615bcacded to your computer and use it in GitHub Desktop.
Código de exemplo https://felipemateus.com/blog/2021/12/mysql-salvando-arquivos-com-nestjs--mysql(abre num novo separador)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelector('input[type="file"]').onchange = async function(e){ | |
const files = this.file | |
const formData = new FormData(); | |
formData.append('file', files[0]); | |
const res = await axios.post('/files', formData, { | |
headers: { | |
'Content-Type': 'multipart/form-data' | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment