How can I send a picture in j2me maybe using base64 decode and the send in post form via http request
A:
HttpConnection connection = (HttpConnection) Connector.open("http://www.myserver.com");
connection.setRequestMethod(HttpConnection.POST);
connection.setRequestProperty("Content-Type","image/png");
OutputStream os = connection.getOutputStream();
// write your picture data to os
os.flush();
if (connection.getResponseCode() == HttpConnection.HTTP_OK)
{
Dmitry Khalatov
2008-12-23 16:39:15
A:
Yes , I'm use that to send the base64 ,putting in
// write your picture data to os
os.write (data);
where data = String with a base64 image , the problem is that i don't have a base64 library that works in java and asp in the same way.
Juancho
2008-12-26 11:26:50
A:
Have you considered using a "multipart/form-data" encoding type? If you so, then there is no need for Base64 encoding. See here and here for instructions on how to build the request.
If you still want to do the Base64 encoding, then you will be able to easily find many source implementations on the Web. If you are developing both the server and client side, you could use your own implementation on both ends.
kgiannakakis
2008-12-29 09:42:58
A:
There are plenty of coders in Base64 for Java. Apache commons has one, here is a standalone one.
Fernando Miguélez
2008-12-29 09:48:41