Download the image to the server using the message parameter.

Hello experts,

I want to download an image on the server by using the post method with parameter alongsome such as file name, status, tag, deviceid, name of the device.

Server taking some as windows credentials. I connect a .html page which, in my url, it must be all the parameter and in action, he goes to the .php file and it image upload server-side.

I use this code, I have my tent for the last 3 days but I get no success.

Please help me...

My code is: -.

private String httpConn (String file) {HttpConnection conn = null; OutputStream os = null; InputStream is = null; String url = ""; int respcode = 0; path of the Web service from which image will be transferred. URL = "" http://usertest[email protected]/admin/image_upload_iphone_app.html ";" Try {conn = (HttpConnection) Connector.open (url); conn.setRequestMethod (HttpConnection.POST); String name = "file:///" + file; FileConnection fc = (FileConnection) Connector.open (name); is = FC.openInputStream (); / * byte [] imgData = IOUtilities.streamToBytes (is); is. Read (imgData); * / byte [] ReimgData = IOUtilities.streamToBytes (is); Resize Image according to setting. Byte [] imgData = reszieImage (ReimgData); is. Read (imgData); String limit = "---14737809831466499882746641449"; String body = ""; name of the file... body = "\r\n--" + limit + "\r\n"; body & = "Content-Disposition: form-data; Name=\"filename\"\r\n\r\n"+"test.jpg '; body += "\r\n--" + limit + "\r\n"; tag... body = "\r\n--" + limit + "\r\n"; body & = "Content-Disposition: form-data; name =-"tag\" \r\n\r\n "+ 'tag'; body += "\r\n--" + limit + "\r\n"; status... body = "\r\n--" + limit + "\r\n"; body & = "Content-Disposition: form-data; name =-"status\" \r\n\r\n "+ 'status'; body += "\r\n--" + limit + "\r\n"; Device ID... body = "\r\n--" + limit + "\r\n"; body & = "Content-Disposition: form-data; name =-"deviceid\" \r\n\r\n "+"deviceid"; body += "\r\n--" + limit + "\r\n"; DeviceModel... body = "\r\n--" + limit + "\r\n"; body & = "Content-Disposition: form-data; name =-"devicemodel\" \r\n\r\n "+"devicemodel"; body += "\r\n--" + limit + "\r\n"; image... body = "\r\n--" + limit + "\r\n"; body & = "Content-Disposition: form-data; name =------'URL '; filename=\""+"test.jpg"+"\r\n '; body & = "" Content-Type: application/octet-stream\r\n\r\n ";" body & = new String (imgData); body += "\r\n--" + limit + "-" + "\r\n"; conn.setRequestProperty ("Content-Type", "multipart/form-data;" + limit); OS = conn.openOutputStream (); OS. Write (Body.GetBytes ()); OS. Close(); / * / / SEND the IMAGE int index = 0; int size = 1024; {System.out.println ("write:" + index);} If ((index+size) > imgData.Length) {size = imgData.length - index ;} os.write (imgData, index, size);} size of the index of +=; } While (index

{0) {}} while(len>0); * / respcode = conn.getResponseCode (); } catch (Exception e) {e.printStackTrace () ;} Finally {//System.out.println ("closely connected"); try {os.close () ;} catch (Exception e) {} try {is.close () ;} catch (Exception e) {} try {() conn.close ;} catch (Exception e) {}} return Integer.toString (respcode);}}} }

Concerning

Pankaj Perron.

It is a solution guys: -.

see...

http://wiki.Forum.Nokia.com/index.php/HTTP_Post_multipart_file_upload_in_Java_ME

Tags: BlackBerry Developers

Similar Questions

Maybe you are looking for

  • iMac 5 k - restart during work - sometimes with Kernel Panic

    Hello my computer restarts during my work 1 or 2 times a day. Sometimes I get a kernel panic Message. Here's my report from panic. Maybe someone can read it. :-) iMac 5K (end of 2015), OS X El Capitan 10.11.6, with all updates, no device on the USB P

  • Re: System failure recovery loop in Satellite A450D - 11H

    Due to a sequence of boot very slow (up to 15 minutes), I decided to restore (recover) of the system back to factory settings. I tried to recover the disk and disks created from the on-board recovery system. In each case I went as far as "the system

  • Programs closed but process shows that it is running

    My computer acted weird since I deleted a virus/malware Protection SystemShield latter.     I have implemented a firewall on my computer also. Some of the problems I've had are: Some computer files were hidden I could only open programs as administra

  • Chicony usb 2.0 graphics rendered in case of failure.

    I have a PC laptop toshiba L300-148 with a built-in webcam running chicony usb 2.0 when I load the camera Assistant software it displays graphic render fail. I tried to re-setup and roll back the driver, I also deleted the devicde of Device Manager a

  • Can't get HP Officejet Pro L7780 Online

    I replaced my old HP computer that uses Windows XP, in my home network with a new computer integrated custom system running Windows 7.  The documents will not print because the computer thinks it is 'offline', and diagnosis tell me to turn it on. He