Hi,
Currently I'm trying to upload an image to my server. Unfortunately the server denies to accept the request, claiming it's syntactically incorrect.
A usual request would look like this:
--0xKhTmLbOuNdArY
Content-Disposition: form-data; name="login"
peer
--0xKhTmLbOuNdArY
Content-Disposition: form-data; name="password"
reep
--0xKhTmLbOuNdArY
Content-Disposition: form-data; name="image"; filename="file"
Content-Type: application/octet-stream
MM½Ð½Ð½½Ð½Ð½Ð½½Ð½Ð½Ð½Ð½½Ð½Ð½½Ð½Ð½Ð½½Ð½Ð½Ð½Ð½½Ð½Ð½½½Ð½Ð½Ð½Ð½0h is invoked is defined as follows:
@POST
@Consumes( MediaType.MULTIPART_FORM_DATA )
@Produces(MediaType.TEXT_PLAIN)
public String uploadImage(@FormParam("login") String login, @FormParam("password") String password, @FormParam("image") File image) {
... process file...
}
The question now is, where the error lies. Is my service wrong (most likely), or is the POST request somehow incorrect. The request is made using a framework called ASIHTTPRequest. I also tried to use byte[] instead of file, but that doesn't work either.
Every help is appreciated.
Cheers,
Daniel