×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Regular Contributor
    Join Date
    Oct 2009
    Location
    Chennai, India
    Posts
    120

    HttpConnection: Download from server

    Hi all,

    I am working with S60 v3 MR, Symbian C++. I want to build a httpconnection that automatically downloads files from url to my device's phone memory images location. I have tried the same app in blackberry it works fine. Nokia's a new stuff for me.. Guide me please? IS there any api that does this?
    Nothing Is Impossible
    hk :)

  2. #2
    Regular Contributor
    Join Date
    Oct 2009
    Posts
    314

    Re: HttpConnection: Download from server

    Quote Originally Posted by hrkrshn View Post
    Hi all,

    I am working with S60 v3 MR, Symbian C++. I want to build a httpconnection that automatically downloads files from url to my device's phone memory images location. I have tried the same app in blackberry it works fine. Nokia's a new stuff for me.. Guide me please? IS there any api that does this?


    Please have a look at this.Hope this might help you

    http://www.forum.nokia.com/info/sw.n..._0_en.zip.html

  3. #3
    Regular Contributor
    Join Date
    Oct 2009
    Location
    Chennai, India
    Posts
    120

    Unhappy Re: HttpConnection: Download from server

    httpclient! Nooo.. I want to download image from the given url and save it to the device, atleast the byte code of the image and convert it to bitmap..

    Is there any way? please help
    Nothing Is Impossible
    hk :)

  4. #4
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144

    Re: HttpConnection: Download from server

    And why wouldn't the HTTP example work for you ?, it actually would be my first suggestion also.

  5. #5
    Regular Contributor
    Join Date
    Oct 2009
    Location
    Chennai, India
    Posts
    120

    Re: HttpConnection: Download from server

    i get only the page source code, but i need the bytes of the page so that i cud convert it as image! Or is der any direct options to save it as image...

    There is a StringLoader in the code that displays the page code, instead of which i tried to put a function from CreatePicturefromFileL() from CEikImage class. If i am right, that should display me the image in the screen instead of the page code. But i dont.

    plz help
    Last edited by hrkrshn; 2009-11-09 at 10:13.
    Nothing Is Impossible
    hk :)

  6. #6
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144

    Re: HttpConnection: Download from server

    I suppose you have misunderstood something, basically with HTTP query, you get the HTTP reply, then if the data in the reply has some embedded links to objects like images, you do need to issue additional HTTP queries for retrieving them.

  7. #7
    Regular Contributor
    Join Date
    Oct 2009
    Location
    Chennai, India
    Posts
    120

    Exclamation Re: HttpConnection: Download from server

    Oh Ya.. I mistook on seeing StringLoader! When a query is given, the response from the page comes as raw data or text??? how d i parse the image alone? pls guide me symbianyucca,
    Nothing Is Impossible
    hk :)

  8. #8
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144

    Re: HttpConnection: Download from server

    Just check the data, you get excatly what you are querying for, so depends on what you query for the data is made for it. I'm assuming that you do you your datasource..

  9. #9
    Regular Contributor
    Join Date
    Oct 2009
    Location
    Chennai, India
    Posts
    120

    Re: HttpConnection: Download from server

    Quote Originally Posted by symbianyucca View Post
    Just check the data, you get excatly what you are querying for, so depends on what you query for the data is made for it. I'm assuming that you do you your datasource..
    I can get the raw data of the image link, instead of the source code of the image link! if i can save that raw data with an extension jpg, can i view the image in the phone?
    Nothing Is Impossible
    hk :)

  10. #10
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144

    Re: HttpConnection: Download from server

    You would need to download the actual image data, so take the link, and make a new HTTP request to get the actual image, and yes, you can save the data in a file and then use the file normally, just make sure you only save the image data, and no addition tag.

  11. #11
    Regular Contributor
    Join Date
    Oct 2009
    Location
    Chennai, India
    Posts
    120

    Re: HttpConnection: Download from server

    Thankss for the reply!!!

    But, even if there is a page with only a single image, do i have to give an additional request? I am asking this question because the url i am passing to HttpClient application is of that type.

    If somehow i manage to get the raw data by another request, how can i write it as an image file?? Using RFile? Or do i have to use ImageDecoder?
    Nothing Is Impossible
    hk :)

  12. #12
    Regular Contributor
    Join Date
    Oct 2009
    Location
    Chennai, India
    Posts
    120

    Re: HttpConnection: Download from server

    ERROR:Undefined symbol: 'int RFile::Create(class RFs &, class TDesC16 const &, unsigned int) (?Create@RFile@@QAEHAAVRFs@@ABVTDesC16@@I@Z)'

    What does this error mean?? i have got 4 errors for each Open,Seek and Write function in this code:

    case THTTPEvent::EGotResponseBodyData:
    {
    MHTTPDataSupplier* body = aTransaction.Response().Body();
    TPtrC8 dataChunk;

    body->GetNextDataPart( dataChunk );
    //iObserver.ClientBodyReceived( dataChunk );

    _LIT16(KXMLFilePath, "C:\\Data\\Images\\");
    TFileName iCurrentFileName;
    iCurrentFileName.Append(_L("default.jpg"));
    TInt err=iRFileObj.Open(CCoeEnv::Static()->FsSession(),iCurrentFileName,EFileWrite);

    if (err==KErrNotFound) // file does not exist - create it
    {
    err=iRFileObj.Create(CCoeEnv::Static()->FsSession(),iCurrentFileName,EFileWrite);
    }

    TInt aPos=0;
    iRFileObj.Seek(ESeekCurrent, aPos);
    iRFileObj.Write(dataChunk);

    HBufC* buf = HBufC::NewLC(dataChunk.Length());
    HBufC* iResponseBuffer = HBufC::NewLC(dataChunk.Length());

    buf->Des().Copy(dataChunk);

    if (!iResponseBuffer)
    {
    iResponseBuffer = buf->AllocL();
    }
    else
    {
    iResponseBuffer = iResponseBuffer->ReAllocL(iResponseBuffer->Length()+buf->Length());
    iResponseBuffer->Des().Copy(*buf);
    }

    CleanupStack::PopAndDestroy(buf);

    body->ReleaseData();

    }

    break;
    I have declared the RFile object in header file as public..

    I am doing in MR, but i dont get any error while i compile the code in FP1

    Help please..
    Nothing Is Impossible
    hk :)

  13. #13
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,144

    Re: HttpConnection: Download from server

    You could maybe try searching a bit on this Dibo.. Undefined symbol error has been discussed plenty of times, and it means that you have not included the library required by this API into your project.

  14. #14
    Regular Contributor
    Join Date
    Oct 2009
    Location
    Chennai, India
    Posts
    120

    Re: HttpConnection: Download from server

    Sure.. I guess its the library for RFile! Thanks once again..
    Nothing Is Impossible
    hk :)

  15. #15
    Regular Contributor
    Join Date
    Oct 2009
    Location
    Chennai, India
    Posts
    120

    Re: HttpConnection: Download from server

    Application crashes on giving the url!! And the file is not saved too.. :-( :-( Have a look in the code below.. and do help please
    Nothing Is Impossible
    hk :)

Similar Threads

  1. Sending File to Server using HttpConnection
    By sandeepkumar03 in forum Mobile Java Networking & Messaging & Security
    Replies: 12
    Last Post: 2009-11-26, 13:55
  2. download mp3 files from a remote server to mobile file system
    By jetmaroc in forum Mobile Java Media (Graphics & Sounds)
    Replies: 10
    Last Post: 2009-09-02, 13:59
  3. Mobile learning server / environment published
    By mikaset in forum News and Announcements
    Replies: 0
    Last Post: 2008-03-25, 20:50
  4. How do I download dm file from web server?
    By daniel418 in forum Digital Rights Management & Content Downloading
    Replies: 2
    Last Post: 2004-11-26, 09:07
  5. Replies: 2
    Last Post: 2002-12-03, 03:58

Posting Permissions

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