×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Hyderabad.
    Posts
    99

    How to post image along with text on a single request

    hi,
    I am able to post image,audio,video and text seperatly by a single http request.
    but now i want to post text along with image or audio or video by a single http request.
    is it possible to send text and image at a time by single http request if so please send me some help on how is it possible.
    regards,
    vinod.

  2. #2
    Registered User
    Join Date
    Jun 2006
    Posts
    259

    Re: How to post image along with text on a single request

    Hi,

    How do you post (Using HttpExample client or CHTTPFormEncoder) ?

    Cheer's

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Hyderabad.
    Posts
    99

    Re: How to post image along with text on a single request

    hi,
    I am posting using normal httpconnection.
    regards,
    vinod.

  4. #4
    Registered User
    Join Date
    Nov 2006
    Location
    Buenos Aires, Argentina
    Posts
    37

    Re: How to post image along with text on a single request

    You could post the information by using a multipart encoding, that way you send a single post with an special format that separates the different variables.

    I did that over a SocketConnection so I had to build the multipart manually. I'll look for an example to send to you.

    Cheers,
    Ariel

  5. #5
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Hyderabad.
    Posts
    99

    Re: How to post image along with text on a single request

    hi,
    Thank you very much it will be helpfull for me if you send an example on it.
    regards,
    vinod.

  6. #6
    Registered User
    Join Date
    Mar 2003
    Posts
    23

    Solution to your problem

    I am posting an Image and Text (such as name, address, phone no) in the same request.

    I send the image a binary stream and text as http header

    url = "http://"+midlet.getAppProperty("HostName")+":"+midlet.getAppProperty("PortNo")+"/"+midlet.getAppProperty("ConnectString")+"/"+midlet.getAppProperty("ServletName");

    con = (HttpConnection)Connector.open(url + "?CL=" + String.valueOf(data.length));
    System.out.println("HTTP Connection Opened : "+con);
    con.setRequestMethod(HttpConnection.POST);
    con.setRequestProperty("Content-Language","en");
    //con.setRequestProperty("Content-Length",String.valueOf(data.length));
    con.setRequestProperty("CLength",String.valueOf(data.length));
    con.setRequestProperty("CustId",customerId);
    con.setRequestProperty("FName",firstName);
    con.setRequestProperty("MName",middleName);
    con.setRequestProperty("LName",lastName);

    con.setRequestProperty("Accept","*/*");
    //con.setRequestProperty("Content-Type","image/png");
    con.setRequestProperty("Cache-Control","no-cache");
    con.setRequestProperty("Pragma","no-cache");

    os = con.openDataOutputStream();
    os.write(data);
    os.flush();
    os.close();
    in = con.openInputStream();


    Hpe this solves your problem

  7. #7
    Registered User
    Join Date
    Jun 2006
    Posts
    8

    Re: How to post image along with text on a single request

    Hi,

    I think if you get to program the server app to extract the information from the headers then it's a really good idea.

    I was just working on the client on the phone and I was given a similar task so I did it like arielbt below and programmed it manually using SocketConnection.

    Used SocketConnection because I was facing problems with HttpConnection and uploading using multipart encoding. I think that if it's not possible to do it with HttpConnection may have to do it that way.

  8. #8
    Registered User
    Join Date
    Sep 2006
    Posts
    14

    Re: How to post image along with text on a single request

    Hi Badquek,
    Can u send me a code sample, how u did it?
    my applicaion needs to send multiple photos in asingle connection.

    So please Help me.

    Regards
    Rajesh

  9. #9
    Registered User
    Join Date
    Dec 2006
    Posts
    2

    Re: How to post image along with text on a single request

    Hi,
    arielbt I want to ask you something.You said that you could post information by using a multipart encoding,so you could send more types of information in one request.
    I am working on a 3rd Edition SDK.I tried to modify the httpexample,but with no success in sending a multipart encoded request.I used RHTTPSession and RHTTPTransaction.
    You said that you could send a multipart encoded request over a SocketConnection.Can you please send me an example or a portion of your code where you build
    and send the multipart encoded request?
    Or anything that could help me in sending a multipart encoded request.
    What still remains a mistery to me is how do I send this file to the server over a SocketConnection like you did? Especially if the server requires authentication.I would appreciate it if you could help me here.

  10. #10
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,697

    Re: How to post image along with text on a single request

    hi,

    @all
    crossposted with C++ section:
    http://discussion.forum.nokia.com/fo...ad.php?t=96282

    @floky:
    i'm not C++ but see that resource files:
    S60 Platform: HTTP Client API Example v2.0

    regards,
    Peter

Similar Threads

  1. two text fields in a single row
    By hnipak in forum Mobile Java General
    Replies: 11
    Last Post: 2006-09-22, 16:02
  2. HTTP Request Pipelining
    By shashishaw in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2006-08-25, 16:24
  3. SymC++ - S60- HTTP Post Data - How to encode body text?
    By periakaruppan in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2005-08-29, 11:31
  4. Replies: 0
    Last Post: 2005-08-29, 11:30
  5. how to extract multiple images from Single Image File
    By memphis_ in forum Mobile Java General
    Replies: 2
    Last Post: 1970-01-01, 02:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×