Skip to content

Spring-MVC: Problem Upload a File #1273

@glederrey

Description

@glederrey

Hi,

I have a problem when I try to upload a file.. Here is the json spec:

"/video/attachment/add": {
  "post": {
    "tags": [
      "Video"
    ],
    "consumes": [
      "multipart/form-data"
    ],
    "produces": [
      "application/json"
    ],
    "operationId": "addAttachmentVideo",
    "description": "Add an attachment to the video with a specific id.",
    "summary": "Add an attachment to a video",
    "parameters": [
      {
        "name": "docId",
        "in": "query",
        "description": "ID of the document",
        "required": true,
        "type": "string"
      },
      {
        "name": "file",
        "in": "formData",
        "description": "File to attach to the video",
        "required": true,
        "type" : "file"
      },
      {
        "name": "attachmentName",
        "in": "query",
        "description": "Name of the attachment",
        "required": true,
        "type": "string"
      }
    ],
    "responses": {
      "200": {
        "description": "Succesfully attached.",
        "schema": {
          "type": "string"
        }
      },
      "400": {
        "description": "Malformed request."
      },
      "403": {
        "description": "Request could not be authorized."
      },
      "500": {
        "description": "Internal Server Error."
      }
    }
  }
}  

I just generated a Stub server using Spring-MVC and when I try to call this endpoint, I get this error:

Server Error</pre></p><h3>Caused by:</h3><pre>org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalArgumentException: Expected MultipartHttpServletRequest: is a MultipartResolver configured?

Do I really need a MultipartResolver?? If yes, where should I put it??

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions