×

Discussion Board

Results 1 to 1 of 1

Threaded View

  1. #1
    Registered User
    Join Date
    Sep 2009
    Location
    Punr
    Posts
    13

    Post How to post/upload image as a content data of form

    Hi All,

    I want to post/upload an image to URL like http://xyz.com.
    I'm posting data as a form content code is given below.
    How do I post an image. Is it possible to post it just using image path? or do I need image content like binary data.
    It should be like we do in HTML <input type="submit" value="Send"> and selected file gets uploaded.
    I got image path now can u please tell the way to post it using path.



    TUriParser8 uri;
    uri.Parse(*iUri);

    // Copy data to be posted into member variable; iPostData is used later in
    // methods inherited from MHTTPDataSupplier.
    delete iPostData;
    iPostData = 0;
    iPostData = iBody->AllocL();

    // Get request method string for HTTP POST
    //RStringF method = iSession.StringPool().StringF(HTTP::EPOST,RHTTPSession::GetTable());
    RStringF method = iSession.StringPool().StringF(HTTP::EPOST,RHTTPSession::GetTable());

    // Open transaction with previous method and parsed uri. This class will
    // receive transaction events in MHFRunL and MHFRunError.
    iTransaction = iSession.OpenTransactionL(uri, *this, method);
    iTransactionOpen = ETrue;

    // Set headers for request; user agent, accepted content type and body's
    // content type.
    RHTTPHeaders hdr = iTransaction.Request().GetHeaderCollection();
    SetHeaderL(hdr, HTTP::EUserAgent, KUserAgent);
    SetHeaderL(hdr, HTTP::EAccept, KAccept);
    SetHeaderL(hdr, HTTP::EContentType, KContentTypeForm);

    // Set this class as an data supplier. Inherited MHTTPDataSupplier methods
    // are called when framework needs to send body data.
    MHTTPDataSupplier* dataSupplier = this;
    iTransaction.Request().SetBody(*dataSupplier);


    // Submit the transaction. After this the framework will give transaction
    // events via MHFRunL and MHFRunError.
    iTransaction.SubmitL();


    Regards,
    Last edited by bnpawar; 2009-11-13 at 11:36.
    Bharat Pawar,
    Software Engineer

Similar Threads

  1. labels are not visible in form data fields.
    By pankaj gupta55 in forum Symbian
    Replies: 1
    Last Post: 2008-12-16, 10:12
  2. show image on the form from memory
    By aaapigfly in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2007-08-27, 20:15
  3. image input element types in form -problem
    By seanos11 in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2004-11-01, 15:25
  4. Loading Image data from 'raw' bytes
    By LongSteve in forum Mobile Java General
    Replies: 2
    Last Post: 2002-11-20, 17:38
  5. Get pixel data from an image object on Nokia phones?
    By inopia in forum Mobile Java General
    Replies: 1
    Last Post: 2002-05-15, 09:27

Posting Permissions

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