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' |
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
import { | |
Controller, | |
Get, | |
Param, | |
Post, | |
Res, | |
UploadedFile, | |
UseInterceptors, | |
} from '@nestjs/common'; | |
import { FileInterceptor } from '@nestjs/platform-express'; |
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
<form action="/files" method="post" enctype="multipart/form-data"> | |
<input type="file" id="file" name="fike"><br><br> | |
<button type="submit">Submit</button> | |
</form> |