×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    16

    How to download a File from a server using HTTP

    I already have an application which can send HTTP requests

    using this objects

    RSocketServ
    RSocket
    RHostResolver


    But how can I download a file from the server
    specifically just a plain text (.txt) file

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

    Re: How to download a File from a server using HTTP

    it should come with your reply message from the server, so have you checked what the reply contains ?

    Also did you know that there is a full HTTP example available at the examples section: http://www.forum.nokia.com/info/sw.n...I_Example.html

  3. #3
    Super Contributor
    Join Date
    Oct 2007
    Location
    જુનાગઢ - India
    Posts
    3,034

    Re: How to download a File from a server using HTTP

    Check MHFRunL() method of ClientEngine.cpp file in Http client example mentioned by symbianyucca.

  4. #4
    Registered User
    Join Date
    May 2009
    Posts
    16

    Re: How to download a File from a server using HTTP

    Quote Originally Posted by symbianyucca View Post
    it should come with your reply message from the server, so have you checked what the reply contains ?

    Also did you know that there is a full HTTP example available at the examples section: http://www.forum.nokia.com/info/sw.n...I_Example.html
    Yes I already have read through it

    I already retrieve the response text from the server

    I'm just confused cause I don't know how to save the file itself
    coming from the server because it's just response text.
    Is there a library for directly saving the file.

    EDIT:

    Sorry this was a different documentation I'll be reviewing this first
    thanks for the replies
    Last edited by rozzwalla; 2009-06-22 at 08:50.

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    16

    Re: How to download a File from a server using HTTP

    Ok I'm done reviewing and testing the sample application given by symbianyucca
    the response text is the same in my current application.

    How can I save the file into the phone in
    the same format using those response text's?

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

    Re: How to download a File from a server using HTTP

    if the response if only the file, you could then use RFile for writing it to a file.

  7. #7
    Registered User
    Join Date
    May 2009
    Posts
    16

    Re: How to download a File from a server using HTTP

    Quote Originally Posted by symbianyucca View Post
    if the response if only the file, you could then use RFile for writing it to a file.
    Tell me if my logic is correct

    > Get Response Text
    > Write it into a file
    > Save the file into the phone
    > File name and the extension i want (i.e. sample.txt)
    > Save file in the phone = File in the server?

    by the way I'm using a domino server as my http host

    Many Thanks.

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

    Re: How to download a File from a server using HTTP

    yep just
    > Get Response Text
    > Write it into a file

    and it should be there, of course it could be that the extension needs ot be correct in the file name, but most often files in Symbian are recognized according to their actual data not the extension.

  9. #9
    Regular Contributor
    Join Date
    Jul 2006
    Posts
    85

    Re: How to download a File from a server using HTTP

    I have been trying hard to download a SISX /DRM file using the method provided below
    http://www.forum.nokia.com/info/sw.n...I_Example.html

    But everytime , I get the same error message -33( KErrTimeOUT)

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

    Re: How to download a File from a server using HTTP

    it is not clear from your other posts: http://discussion.forum.nokia.com/fo...ht=#post763043, that did you ever try downloading something else from the same Url, I would not think that the timeout would be related to content type really, unless you have some fiewall etc. that would prevent accessing places according to teh filetypes being downloaded.

  11. #11
    Registered User
    Join Date
    Jul 2009
    Posts
    29

    Re: How to download a File from a server using HTTP

    Quote Originally Posted by rozzwalla View Post
    I already have an application which can send HTTP requests

    using this objects

    RSocketServ
    RSocket
    RHostResolver


    But how can I download a file from the server
    specifically just a plain text (.txt) file
    Can you share me your code using Socket ?

  12. #12
    Registered User
    Join Date
    Jul 2009
    Posts
    29

    Re: How to download a File from a server using HTTP

    Quote Originally Posted by rozzwalla View Post
    Ok I'm done reviewing and testing the sample application given by symbianyucca
    the response text is the same in my current application.

    How can I save the file into the phone in
    the same format using those response text's?
    Hi,

    Can you use this to save data response from the server to file

    Code:
    #define KMyTestFileName    _L("myTest.txt")
    void CMyAppView::ClientBodyReceived(const TDesC8& aBodyData)
    	{
    	if (aBodyData.Length() > 0)
    		{				
    		RFs fs;
    		User::LeaveIfError(fs.Connect());
    		CleanupClosePushL(fs);
    
    		TFileName filePath;
    		User::LeaveIfError(fs.SessionPath(filePath));
    		filePath.Append(KMyTestFileName);
    
    		RFile file;
    		if (KErrNone == file.Open(fs, filePath, EFileWrite))
    			{
    			if (KErrNone == file.Write(0, aBodyData))
    				{
    				file.Flush();
    				}
    			}
    		file.Close();
    		
    		fs.Close();
    		CleanupStack::PopAndDestroy(&fs);
    		}
    	}
    Last edited by quangndba; 2010-08-03 at 07:04. Reason: edit file name

Similar Threads

  1. Upload file to HTTP server
    By symbi4n_programmer in forum Symbian
    Replies: 4
    Last Post: 2009-03-20, 16:44
  2. Determing size of file http server
    By msulaiman in forum Symbian Networking & Messaging (Closed)
    Replies: 1
    Last Post: 2007-03-28, 16:22
  3. Replies: 1
    Last Post: 2005-05-26, 14:22

Posting Permissions

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