Reputation: 18120
This is roughly the code I'm working with now:
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("json", json.toString()));
nameValuePairs.add(new BasicNameValuePair("blob", file.getAbsolutePath()));
post_request.setEntity(new UrlEncodedFormEntity(nameValuePairs));
The the reply I get back from the server is good for the first add()
statement but, for the second one I'm not trying to send the path, I'm trying to send the file. Taking off .getAbsolutePath()
should do the trick, but It won't let me as it only accepts strings. How would I go about sending the file?
Upvotes: 1
Views: 255
Reputation: 20875
you should use a MultipartEntity, not an UrlEncodedForm one. In a Multipart body you can store objects of different mime types
Upvotes: 1