You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A while ago, I had an issue where files sent as an array weren't appropriately received on the server and to fix this I used this hack from another issue that was opened about this: #47 (comment)
Now, when using version 1.9.1 I can't send an array of files, the validation always fails for the size and type of the files. It would only work if I send one file. Please how can I solve this? I have used the code from the readme even to see if it would work but it still doesn't work.
DTO:
exportclassImagePostDtoextendsBasePostDto{
@IsFiles({each: true})
@MaxFileSize(1e7,{each: true,message: 'The maximum size for a file is 10mb'})
@HasMimeType(types,{each: true,message: (e)=>{return`Error message`;},})files: FileSystemStoredFile[];}
And I tried to send both via Postman and via my code, neither would work:
Code:
constformData=newFormData();// files is just an array of filesfor(constfileoffiles){formData.append('files[]',file);}axios.post(url,formData);
PostMan:
And this is the error I get:
{"message":["Error message","The maximum size for a file is 10mb","Field \"files\" does not contain file"],"error":"Bad Request","statusCode":400}
Here are the images that I'm sending from the request body log:
@Yuniac Hi, I am trying to reproduce your issue but it is not reproducible.
Automatic tests will not allow you to certify a version with obvious behavioral errors.
Please provide more details about your environment, nest version, nodejs, controller.
Or create a small repository where the issue is reproduced.
Here is my environment where I tried:
Hello. Thanks for creating this library.
A while ago, I had an issue where files sent as an array weren't appropriately received on the server and to fix this I used this hack from another issue that was opened about this: #47 (comment)
Now, when using version
1.9.1
I can't send an array of files, the validation always fails for the size and type of the files. It would only work if I send one file. Please how can I solve this? I have used the code from the readme even to see if it would work but it still doesn't work.DTO:
And I tried to send both via Postman and via my code, neither would work:
Code:
PostMan:
And this is the error I get:
Here are the images that I'm sending from the request body log:
Thanks in advance. I appreciate any further guidance on those to properly use your library
The text was updated successfully, but these errors were encountered: