×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    14

    help needed:how to upload multiple photos in a single connection?

    hi all, please help me out i am not getting any idea how to upload multiple photos in a single http connection.

    i am able to apload single photo in single connection,
    but my application needs to upload all photos ince the connection is made to server.
    so please give me any idea as well as some code snippet for this.

    this is the code i am using for upload a single photo to erver. but i need application for upload multiple photos in a single connection.

    //client side code

    public StringBuffer buildHTTPConnection(byte[] byteImage, String ImageName,String stringImage ) {
    HttpConnection hc = null;
    OutputStream out = null;
    StringBuffer b=null;
    try {
    String url = new String("http://www.retailperformancemonitor.com/disconnected-client/ImageServlet?ImageUrl=" + ImageName);

    // Obtain an HTTPConnection
    hc = (HttpConnection) Connector.open(url);
    // Modifying the headers of the request
    hc.setRequestMethod(HttpConnection.POST);
    // Obtain the output stream for the HttpConnection
    out = hc.openOutputStream();
    out.write(stringImage.getBytes());
    int ch;
    b = new StringBuffer();
    InputStream is = hc.openDataInputStream();
    while ((ch = is.read()) != -1) {
    b.append((char) ch);
    }

    } catch (IOException ioe) {
    StringItem stringItem = new StringItem(null, ioe.toString());
    } finally {
    try {
    if (out != null)
    out.close();
    if (hc != null)
    hc.close();
    } catch (IOException ioe) {
    }
    }
    return b;
    }

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

    Re: help needed:how to upload multiple photos in a single connection?

    hi,

    you haven't posted entire code (part for image part upload is missing),
    anyway, try existing opern source projects like mobup flickr to see how image upload from device to webserver can be implemented:
    http://sourceforge.net/projects/mobup
    (sources available),

    hth
    regards,
    Peter

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

    Re: help needed:how to upload multiple photos in a single connection?

    hello peter,

    The arguments of the function are "String stringImage ,String ImageName".
    "stringImage" is the string format of the image, and "ImageName" is the Name os the image.


    public StringBuffer buildHTTPConnection(String ImageName,String stringImage ) {
    HttpConnection hc = null;
    OutputStream out = null;
    StringBuffer b=null;
    try {
    String url = new String("http://www.retailperformancemonitor.com/disconnected-client/ImageServlet?ImageUrl=" + ImageName);

    // Obtain an HTTPConnection
    hc = (HttpConnection) Connector.open(url);
    // Modifying the headers of the request
    hc.setRequestMethod(HttpConnection.POST);
    // Obtain the output stream for the HttpConnection
    out = hc.openOutputStream();
    out.write(stringImage.getBytes());
    int ch;
    b = new StringBuffer();
    InputStream is = hc.openDataInputStream();
    while ((ch = is.read()) != -1) {
    b.append((char) ch);
    }

    } catch (IOException ioe) {
    StringItem stringItem = new StringItem(null, ioe.toString());
    } finally {
    try {
    if (out != null)
    out.close();
    if (hc != null)
    hc.close();
    } catch (IOException ioe) {
    }
    }
    return b;
    }


    please help me for getting solution.

    Regards
    Rajesh.

Similar Threads

  1. Multiple programs within single SIS file dilema
    By LongSteve in forum Symbian
    Replies: 6
    Last Post: 2008-03-20, 06:05
  2. need help for uploading multiple photos
    By mrrajesh_1982 in forum Series 40 & S60 Platform Feedback Archive
    Replies: 0
    Last Post: 2006-09-29, 15:54
  3. Replies: 3
    Last Post: 2006-05-02, 20:12
  4. Multiple connection Bluetooth or Single USB
    By festicus in forum Bluetooth Technology
    Replies: 1
    Last Post: 2006-03-20, 06:06
  5. Replies: 1
    Last Post: 2003-10-03, 15:28

Posting Permissions

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