×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Feb 2005
    Posts
    77

    Uploading File From Series-60 Phone To Web Server Thru C++ Application?

    Hi,

    Using Symbian C++, need to upload a file from a Series-60 phone to a web server.

    I believe it can be done thru a web client using HTTP C++ classes. Done some coding to make HTTP calls by using Nokia site's some sample application. This way, i can GET/POST variables to web server/pages.

    I am stuck on how to upload a whole file. Is there any way to attach a file and then POST the page? Or, any mechanism to read the data in batches and send them accordingly? Any code snippet/resource URL/advise?

    Hoping to get some assistance/help from you guys.

    Thanks and regards,
    Peri

  2. #2
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359
    void SendFile(const TDesC8 aURL, const TDesC8& aDataBuffer, const TDesC8& aMimeType )
    {
    _LIT8(KPost ,"POST ");
    _LIT8(KHTTP ," HTTP/1.0");
    _LIT8(KPostSize ,"Content-Length: ");
    _LIT8(KPostMime ,"Content-Type: ");
    _LIT8(KNewLine ,"\r\n");

    TPtr8 buf = iBuffer->Des();
    buf.SetLength(0);

    buf.Append(KPost); buf.Append(aUrl); buf.Append(KHTTP);
    buf.Append(KNewLine);
    buf.Append(KPostSize); buf.AppendNum(aDataBuffer.Length());
    buf.Append(KNewLine);
    buf.Append(KPostMime); buf.Append(aMimeType);
    buf.Append(KNewLine);
    buf.Append(KNewLine);
    buf.Append(aDataBuffer);
    buf.Append(KNewLine);

    //...
    // send
    //...

    }

  3. #3
    Registered User
    Join Date
    Apr 2006
    Posts
    1

    Re: Uploading File From Series-60 Phone To Web Server Thru C++ Application?

    Hi Itomuta

    I've been struggling for the last whole week to find a way to upload a complete file. At last, I came across your reply which seems promising.
    Could you please tell me which function/API you are using, because sendfile() is not present in the standard HTTP API that I downloaded from Nokia's website.
    I'm using Symbian OS v7 with SDK version 2.

    Many thanks in advance...
    Rahul

  4. #4
    Registered User
    Join Date
    Apr 2005
    Location
    Barcelona
    Posts
    1,678

    Re: Uploading File From Series-60 Phone To Web Server Thru C++ Application?

    Just using simple a RSocket will do, and will work on any s60.

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,689

    Re: Uploading File From Series-60 Phone To Web Server Thru C++ Application?

    Quote Originally Posted by rahul_r83
    because sendfile() is not present in the standard HTTP API that I downloaded from Nokia's website.
    I'm using Symbian OS v7 with SDK version 2.
    The code Itomuta has sent is your "sendfile" method. Open a TCP/IP RSocket to the given host, and use RSocket::Write(*iBuffer) to send the data.
    iBuffer should be a HBufC8*, and initialize it with HBufC8::NewL(aURL.Length()+aDataBuffer.Length()+aMimeType.Length()+50).

  6. #6
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: Uploading File From Series-60 Phone To Web Server Thru C++ Application?

    See %EPOCROOT%\Examples\appprots\exampleclient for an http post solution using the HTTP stack. There are some known issues with it but is definitely a good starting point...

Posting Permissions

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