Wrong input type in multi-file upload
See original GitHub issueQ&A
- Browser: chrome, mozilla
- Swagger-UI version:
Swashbuckle.AspNetCore.SwaggerUI
v4.0.1 - Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration
[HttpPost]
public string UploadFiles(ICollection<IFormFile> files)
{
return "";
}
Example Swagger/OpenAPI definition:
"/api/File": {
"post": {
"tags": [
"File"
],
"operationId": "UploadFiles",
"consumes": [
"multipart/form-data"
],
"produces": [
"text/plain",
"application/json",
"text/json"
],
"parameters": [
{
"name": "files",
"in": "formData",
"required": false,
"type": "array",
"items": {
},
"collectionFormat": "multi",
"uniqueItems": false
}
],
"responses": {
"200": {
"description": "Success",
"schema": {
"type": "string"
}
}
}
}
},
Swagger-UI configuration options:
From Swashbuckle.AspNetCore.SwaggerUI
app.UseSwaggerUI(c => c.SwaggerEndpoint($"/swagger/{SwaggerDocumentVersion}/swagger.json", $"{SwaggerDocumentVersion} docs"));
Describe the bug you’re encountering
Input type is text
rather than file
when a method receives muliple files (either IEnumerable<IFormFile>
or IFormFileCollection
) as argument.
Current behavior
Expected behavior
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Multiple file upload -- works fine when all documents are ...
The problem appears to be that when you have a blank file input, it returns an 'error' value of 4 which means UPLOAD_ERR_NO_FILE...
Read more >Error Messages Explained - Manual - PHP
It checks the existance of a form field names "max_file_size" (upper case is also OK), which should contain an integer with the maximum...
Read more >File Uploads - Laravel Livewire
Livewire makes uploading and storing files extremely easy. First, add the WithFileUploads trait to your component. Now you can use wire:model on file...
Read more >[Drag and Drop Multiple File Upload - Contact Form 7] Support
Newst WordPress Version: Invalid Link on multifile images upload ... How can I change text in Drag and Drop Uploading area in specifc...
Read more >Text Inputs - Materialize
You can also use the multiple attribute to allow multiple file uploads. File. <form action= ...
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
@eduherminio - that’s OpenAPI (Swagger) 2.0, not OpenAPI 3.0. The 2.0 version does not support multi file uploads.
Oops, totally right @webron, I’ll close this and create a new one if I experience issues once I configure the project to use 3.0.