Created
February 8, 2017 17:55
-
-
Save marcustallberg/d1bae55dd408f964579f1012b2b2e659 to your computer and use it in GitHub Desktop.
Stress testing a file-upload with Apache Bench
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ab -n 10 -c 2 -p /Users/post_file.txt -T "multipart/form-data; boundary=1234567890" http://localhost/upload | |
post_file.txt (use CRLF line-endings): | |
--1234567890 | |
Content-Disposition: form-data; filename="file.png" | |
Content-Type: application/octet-stream | |
Content-Transfer-Encoding: binary | |
<base64 encoded file> | |
--1234567890-- |
You need to either change Content-Transfer-Encoding
to binary
, or insert the binary file data instead of the base64 encoded file.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the server recieve the file , but not a valid image
byte[] imageBytes = part.getData();
FileUtils.writeByteArrayToFile(new File("d:/tmp/face/test_ab.jpg"), imageBytes);