I am building a servlet that accepts an image in a POST request. with each post there should be an associated ID. My question is how to pass these two distinct data values in a post, where one is a short string, and another is a large chunk of binary data.
I could have both as post parameters,
id=123
content=...megabytes of binary data...
but I need the flexibility of handling the content as a stream, as it could be quite large. I could also follow the above pattern by parsing the input myself as binary data, which I'd like to avoid. I guess I'd need to parse it character by character looking for the keys. ugly.
Am I missing the correct pattern for handling this?