Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Postman - Required MultipartFile parameter 'file' is not present

I'm trying to call a post method with postman version 5.3.1 but I got the following error: "Required MultipartFile parameter 'file' is not present". I tried disabling the "Content-Type" Headers. I attached the file in the body section, selecting the form-data option and putting "file" on key input field.

I'm looking this post jQuery Ajax file upload : Required MultipartFile parameter 'file' is not present too but I cannot get a solution.

like image 911
gemr1423 Avatar asked Oct 30 '22 00:10

gemr1423


1 Answers

I will try to answer, I might be wrong if I am misunderstanding the issue. In postman you should adjust the header as multipart/from-data, do this in order to upload a file using an endpoint.

This will be done here:

enter image description here

and here:

enter image description here

enter image description here

I really hope this helps, if not let me know, with more detail about the issue

===EDIT===

We are in a good path. You are receiving a "The request was rejected because no multipart boundary was found", and that is because your app need to split the "Multipart" being sent, and your application is complaining that it wasn't able to separate the data because it wasn't able to find its boundary, please read rfc1341 - 7.2.1 Multipart: The common syntax, where they explain about how boundairs work.

Now please try adding a boundary to the call. i.e.

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

enter image description here

You will find the explanation on the documentation, on my test bed it worked, I hope this works for you (if not can you please provide the code example of you server endpoint).

like image 61
Pablo Palacios Avatar answered Nov 09 '22 14:11

Pablo Palacios