Welcome to the Official BlackBerry® Support Community Forums. This is your resource to discuss support topics with your peers, and learn from each other. New to the forum? Please visit the ‘Getting Started’ link below.
inside custom component

Java Development

Reply
New Member
sparkvirusxs
Posts: 1
Registered: 10-06-2011
My Carrier: Developer

upload Images to server via http or webservice

[ Edited ]

Hello everyone:

 

   I'm having troubles with my app. I developed a web service to receive the info from a form in BB. Everything works ok. But now, I need to extend my web service to receive images from the device. I tried to extract the file bytes

 

FileConnection file = (FileConnection) Connector.open(path_to_file);
byte[] photoRaw = new byte[(int) file.fileSize()];
try {
   InputStream input = file.openInputStream();
   input.read(photoRaw);
} catch (EOFException e) {}
setPhotoFile(photoRaw);

and send them as a parameter. But when I create the java ImageIcon with this byte[] on server i get a  "Unsupported JPEG process: SOF type 0xcf" (something related to a "lossless" operation on jpg image). Am I creating the byte[] in the better way?

 

After many work arounds (all unsucceful), I tough that maybe I can use an httpconnection to send the image to the server and there I would figure out how to use it, but I don't have a clue on how to do this. Any ideas?

 

I really don't care the format of the image that reach the server, as long as I can see it :smileytongue:. I'm using JDE 5.0 on device side, and JBoss on server side.

Please use plain text.