×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Mar 2003
    Posts
    12

    RHttpDownload file name access

    Hey,

    Does anyone know how to go about retrieving the filename associated with an RHttpDownload?

    As a secondary question that might make the first moot, I've attempted to do a Move of a download only to find the file is not ultimately being moved. Currently I'm trying to move the file to the \resource\apps\ directory which might be having capability issues. Are there particular directories set to allow user data writing capabilities (or file moving)?

    Thanks

    Scott

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

    Re: RHttpDownload file name access

    have you checked the functions provided by the class ?
    for exmaple it has GetFileHandleAttribute, that gives you the handle for the RFile, and with RFile APIs functions, you could get the name easily.

    I would suggest you to read data caging part of the platform security, it could explain to you, why you can not write to the resource folder.

  3. #3
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    61

    Unhappy Re: RHttpDownload file name access

    I have a problem with storing downloaded contents (a gif file) after it has been downloaded. I create a download as follows
    Code:
    EXPORT_C TInt CFileDownloaderBase::Download(
            const TDesC& aUrl, const TDesC& aDestFileName)
    {
        TInt result = KErrArgument;
        if(!aUrl.Length())
            return result;
        TInt iapId=api::SB_GetSettingLong(STE_IAPID,-1);
        if(iapId==-1)
            return KErrCouldNotConnect;
        
        try
        {
            START_SYMBIAN_EXCEPTION_HANDLING
            //Set IAP
            User::LeaveIfError(iDownloadMgr.SetIntAttribute(EDlMgrIap, iapId));
            //Convert to UTF8
            HBufC8* pUrl = putils::UnicodeToUTF8L(aUrl);
            CleanupStack::PushL(pUrl);
            TBool bResult;
            RHttpDownload& download=iDownloadMgr.CreateDownloadL((*pUrl),bResult);
            CleanupStack::PopAndDestroy(pUrl);
            if(!bResult) User::Leave(KErrAlreadyExists);
            
            TInt error = download.SetStringAttribute(
                    EDlAttrDestFilename,aDestFileName);
            //error is set to KErrArgument - why?
            User::LeaveIfError( 
                    download.SetIntAttribute( EDlAttrAction, EDoNothing ) );
            
            User::LeaveIfError( download.Start() );
            result = KErrNone;
            FINISH_SYMBIAN_EXCEPTION_HANDLING
        }
        catch(XLeaveException& e)
        {
            result = e.Reason();
            DPRINT(_L8("CFileDownloaderBase::Download - Exception (%d)"),result);
        }
        return result;
    }
    The download starts fine and as far as I can understand it completes with no problem
    Code:
    EXPORT_C void CFileDownloaderBase::HandleDMgrEventL( 
            RHttpDownload& aDownload, THttpDownloadEvent aEvent )
    {
        DPRINT(_L8("CFileDownloaderBase::HandleDMgrEventL - "
                "iDownloadState(%d),iProgressState(%d)"),
                aEvent.iDownloadState,aEvent.iProgressState);
        
        switch(aEvent.iDownloadState)
        {
        case EHttpDlPaused:
            if( aEvent.iProgressState==EHttpContentTypeReceived)
                aDownload.Start();
            break;
            
        case EHttpDlCompleted:
        {
            if( aEvent.iProgressState==EHttpProgNone)
            {
                TFileName filename( _L("c:\\system\\temp\\myfile.gif" ));
                TInt error = aDownload.SetStringAttribute( EDlAttrDestFilename,  filename );
                error = aDownload.Move();
            }
            
            break;
        } //end case EHttpDlCompleted:
        } //end switch(aEvent.iDownloadState)
        
    }
    I print the result of the execution into a file and here is the output
    13/5/2009 13:16:33 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(2),iProgressState(2054)
    13/5/2009 13:16:33 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(1),iProgressState(0)
    13/5/2009 13:16:33 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(2),iProgressState(500)
    13/5/2009 13:16:33 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(2),iProgressState(1000)
    13/5/2009 13:16:34 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(2),iProgressState(1020)
    13/5/2009 13:16:34 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(2),iProgressState(2020)
    13/5/2009 13:16:34 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(3),iProgressState(2021)
    13/5/2009 13:16:34 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(2),iProgressState(500)
    13/5/2009 13:16:34 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(2),iProgressState(1000)
    13/5/2009 13:16:34 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(2),iProgressState(1020)
    13/5/2009 13:16:34 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(2),iProgressState(2030)
    13/5/2009 13:16:35 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(2),iProgressState(2050)
    13/5/2009 13:16:35 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(2),iProgressState(3002)
    13/5/2009 13:16:35 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(2),iProgressState(2051)
    13/5/2009 13:16:35 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(2),iProgressState(2051)
    13/5/2009 13:16:35 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(2),iProgressState(2051)
    13/5/2009 13:16:35 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(4),iProgressState(0)
    13/5/2009 13:16:35 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(4),iProgressState(3000)
    13/5/2009 13:16:35 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(4),iProgressState(3005)
    13/5/2009 13:16:36 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(4),iProgressState(3003)
    13/5/2009 13:17:37 pdmData.cpp,1870 CFileDownloaderBase::HandleDMgrEventL - iDownloadState(13),iProgressState(0)

    As you can see the complete operation finishes successfully but I still do not have my gif file in
    c:\\system\\temp\\myfile.gif.
    Any idea what I am doing wrong? Thanks

  4. #4
    Regular Contributor
    Join Date
    Jan 2009
    Posts
    61

    Re: RHttpDownload file name access

    Well - anyone any ideas? What about accessing downloaded data so I could save it myself. How can I do it?

  5. #5
    Registered User
    Join Date
    Dec 2006
    Posts
    187

    Re: RHttpDownload file name access

    i m also facing problem in downloading that my file downloaded successfully and in observer i m getting 3 times event of "EHttpDlCompleted" and then i m getting event of "EHttpDlDeleting", Y, can any body help me why it giving me 3 times notification in "EHttpDlCompleted" and then EHttpDlDeleting event.
    Last edited by Asif Nazir; 2009-07-09 at 12:23.

  6. #6
    Regular Contributor
    Join Date
    May 2009
    Posts
    51

    Post Re: RHttpDownload file name access

    Quote Originally Posted by Asif Nazir View Post
    i m also facing problem in downloading that my file downloaded successfully and in observer i m getting 3 times event of "EHttpDlCompleted"
    Check aEvent.iProgressState. You'll find it is a different value for event.

Similar Threads

  1. [announce] PyUIQ. Python for UIQ 2.1 and 3.x
    By OscarBernabeu in forum Symbian
    Replies: 35
    Last Post: 2008-01-17, 09:12
  2. Replies: 1
    Last Post: 2005-05-26, 14:22
  3. Series 60 SDK Appwizard on windows xp
    By moonjoor in forum Symbian Tools & SDKs
    Replies: 15
    Last Post: 2003-12-24, 10:22
  4. nokia 7210 modem via IR doesn't work !
    By oussamaaiadi in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2003-03-06, 10:46
  5. Replies: 0
    Last Post: 2002-06-10, 12:24

Posting Permissions

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