CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    May 2001
    Posts
    61

    how to get the filesize of a file, which lies on a ftp server?

    hi,
    does anyone know, how to get filesize of a file lieing on a ftp-server?
    thanx in advance

    dEUs

    greets
    dEUs

  2. #2
    Join Date
    Aug 1999
    Location
    Romania, Bucharest
    Posts
    253

    Re: how to get the filesize of a file, which lies on a ftp server?

    read MSDN Library for FtpGetFileSize Function

    let me know if this help


  3. #3
    Join Date
    May 2001
    Posts
    61

    Re: how to get the filesize of a file, which lies on a ftp server?

    nope id didnt help... my MSDN dont knows that funktion...
    but someone else helped me: CFtpFindFile::FindFile()

    greets
    dEUs

  4. #4
    Join Date
    Aug 1999
    Location
    Romania, Bucharest
    Posts
    253

    Re: how to get the filesize of a file, which lies on a ftp server?

    FtpGetFileSize Function

    --------------------------------------------------------------------------------

    Retrieves the file size of the requested FTP resource.

    Syntax

    DWORD FtpGetFileSize(
    HINTERNET hFile,
    LPDWORD lpdwFileSizeHigh
    );

    Parameters

    hFile
    [in] HINTERNET handle returned from a call to FtpOpenFile.
    lpdwFileSizeHigh
    [out] Pointer to the high-order unsigned long integer of the file size of the requested FTP resource.
    Return Value

    Returns the low-order unsigned long integer of the file size of the requested FTP resource.
    Function Information

    Stock Implementation wininet.dll
    Custom Implementation No
    Header Wininet.h
    Import library Wininet.lib
    Minimum availability Internet Explorer 5
    Minimum operating systems Windows NT 4.0, Windows 95




  5. #5
    Join Date
    May 2001
    Posts
    61

    Re: how to get the filesize of a file, which lies on a ftp server?

    hi,
    im downloading the file via CFtpConnection::GetFile(), thats why this function isnt working...
    the other thing i postet little time ago does not work...
    anyone else?

    greets
    dEUs

  6. #6
    Join Date
    Aug 1999
    Location
    Romania, Bucharest
    Posts
    253

    Re: how to get the filesize of a file, which lies on a ftp server?

    CFtpFileFind::FindFile
    virtual BOOL FindFile( LPCTSTR pstrName = NULL, DWORD dwFlags = INTERNET_FLAG_RELOAD );

    Return Value

    Nonzero if successful; otherwise 0. To get extended error information, call the Win32 functionGetLastError.

    Parameters

    pstrName

    A pointer to a string containing the name of the file to find. If NULL, the call will perform a wildcard search (*).

    dwFlags

    The flags describing how to handle this session. These flags can be combined with the bitwise OR operator (|) and are as follows:

    INTERNET_FLAG_RELOAD Get the data from the wire even if it is locally cached. This is the default flag.


    INTERNET_FLAG_DONT_CACHE Do not cache the data, either locally or in any gateways.


    INTERNET_FLAG_RAW_DATA Override the default to return the raw data (WIN32_FIND_DATA structures for FTP).


    INTERNET_FLAG_SECURE Secures transactions on the wire with Secure Sockets Layer or PCT. This flag is applicable to HTTP requests only.


    INTERNET_FLAG_EXISTING_CONNECT If possible, reuse the existing connections to the server for new FindFile requests instead of creating a new session for each request.
    Remarks

    Call this member function to find an FTP file.

    After calling FindFile to retrieve the first FTP file, you can call FindNextFile to retrieve subsequent FTP files.

    Example

    See the example in the CFtpFileFind class overview.

    CFtpFileFind Overview | Class Members | Hierarchy Chart

    See Also CFtpFileFind::FindNextFile, CFileFind




  7. #7
    Join Date
    May 2001
    Posts
    61

    Re: how to get the filesize of a file, which lies on a ftp server?

    tank u, but i have a msdn on my on
    ok now the code works, i forgot to call FindNextFile once befor calling GetLength()

    greets
    dEUs

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured