问题
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.
- Implementation should be HttpClient3.1 or Java (Don't keep it blank)
- Content encoding :UTF-8
- "Use multipart/form-data for Post" in HTTP sample should be checked.
- In HTTP header (Content-Type : multipart/form-data)
- 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 Typefor 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