@UploadedFile not working with @Body
See original GitHub issueBug Report
So the intention is pretty simple here. want to upload image and store the image url in collection
Current behavior
Input Code
@Post()
@UsePipes(ValidationPipe)
@UseInterceptors(FileInterceptor('additional_image'))
async createCourse(@UploadedFile() files, @Body() createCourseDto: CreateCourseDto
) {
console.log('Files::', files);
console.log('createCourseDto::', createCourseDto);
}
Expected behavior
Possible Solution
Environment
Nest version: X.Y.Z
For Tooling issues:
- Node version: XX
- Platform:
Others:
so this code doesn't upload image and provide any url. what's the nest way to achieve this?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
FileInterceptor and Body Issue in NestJS (upload a file and ...
I have the following controller : createCollection( @UploadedFile() file, @Body ...
Read more >File uploads (profile image, simple, resumable uploads)
The client will not know, nor should it care, where precisely an uploaded file will go on the service (nor what key or...
Read more >File Uploads - Django documentation
Here's a common way you might handle an uploaded file: ... Looping over UploadedFile.chunks() instead of using read() ensures that large files don't ......
Read more >Uploading files using POST forms - Slim Framework
Files that are uploaded using forms in POST requests can be retrieved with the getUploadedFiles method of the Request object. When uploading files...
Read more >Upload files in ASP.NET Core - Microsoft Learn
When files shouldn't be overwritten by an uploaded file with the same name, ... Form does not buffer the entire request body (BufferBody), ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@iaakash I don’t know whether you’ve solved the issue but you need to set
properties: { 'additional_image': {...} }
instead ofproperties: { file: {...} }
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.