Uploading a file - getting file undefined error

Posting to an api: The file is in my working directory. And the process seems to find it because the Content-Length os 44391… however, Request Body says file: undefined

Host: localhost:8080

Accept-Encoding: gzip, deflate, br

Connection: keep-alive

Content-Type: multipart/form-data; boundary=--------------------------295751255441352584230489

Content-Length: 44391

  • :arrow_forward:Request Body
  1. file: undefined

Can you share a screenshot of the request body?


I initially had Content-Disposition set and it didn’t work. (The file name matched the file - filename) Also had Content-Type. I was removing those to just have file to eliminate items.

This is the message signature of the api:

public ResponseEntity<?> fileUpdate(
@RequestHeader(value = “Authorization”, required = true) String authorizationHeader,
@RequestParam Map<String, String> queryParams,
@RequestParam Map<String, String> formParams,
@RequestParam(“file”) MultipartFile file,
@RequestHeader HttpHeaders headers,
HttpServletRequest request) {

Is this a POST or a GET request?

I’m assuming POST, so a bit confused by you have queryParams in there which is normally for a GET request.

What do you have in the Params tab?

The way you have the file included looks correct for a POST request.

You might get a better response on Stack Overflow, but you will need to include a lot more information about your API setup.

Yes it is a POST. Here is a screen shot.

Is there any documentation for this API as mixing query parameters and form data is unusual.

I don’t think Postman is the issue here. It looks like something specific with the API setup.

Does it work using another method like cURL?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.