Getting error “the request was rejected because no multipart boundary was found” while uploading the file in Jmeter

你离开我真会死。 提交于 2019-12-12 02:17:56

问题


I have tried to upload the file in jmeter:

Please find below mentioned details which i passed in request,

Http reuest:

POST: http:${server_name}/attachment

1.File Path : D:\localdrive\test_docs\images.jpg 2.Parameter Name:images.jpg 3.MIME Type:image/jpg

Http Header :

1.Accept :  / ,
2.Content-Type :    multipart/form-data

Response Data :

 {"response":"the request was rejected because no multipart boundary was found"}

could anyone please share the solution on the same .


回答1:


Got it !!!

Make sure that below parameter should be mentioned in HTTP request.

  1. Implementation should be HttpClient3.1 or Java (Don't keep it blank)
  2. Content encoding :UTF-8
  3. "Use multipart/form-data for Post" in HTTP sample should be checked.
  4. In HTTP header (Content-Type : multipart/form-data)
  5. for Parameter-name & MIME-type e.g. In browser enter F12 & hit the request , refer the content in Network tab : Inside Param u will get request param for example if param is : HTML contains= Content-Disposition: form-data; name="file"; filename="images.jpg" Content-Type: image/jpeg

Then Parameter-name :file & MIME-type :image/jpeg should be like this.

& now its work fine ,That's a great relief for me !!!

also thanks Anders for ur answer.




回答2:


  • HTML contains= Content-Disposition: form-data; name="file"; filename="images.jpg" Content-Type: image/jpeg So i have set = Parameter-name :file MIME-type :image/jpeg ; In sample request i have already checked "Use multipart/form-data for Post" which i have not mentioned early.

Then also its not work ... anything else which i missed here




回答3:


  • There is a checkbox inside the sampler which uploads the file that says "Use multipart/form-data for Post" which needs to be checked.
  • If your HTML looks something like this input type="file" name="dataFile" id="fileChooser"/>" your parameter name must be "dataFile" which is the name of the input file field.
  • You can also use a sniffer tool like fiddler for example or the HTTP/S script recorder JMeter has to capture the request and check the MIME Type for example because I'm not sure if jpg files are "image/jpg" MIME Type

Make sure those are correctly formatted and check out what BlazeMeter says about uploading files



来源:https://stackoverflow.com/questions/37021448/getting-error-the-request-was-rejected-because-no-multipart-boundary-was-found

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!