Sign in to follow this  
Followers 0
FreeRider

_FTPGetFileSize Problem

3 posts in this topic

#1 ·  Posted (edited)

Hi all,

I'm trying to use the _FTPGetFileSize function found in a FTP.au3 file and it doesn't work...

The session handle "$ai_FTPGetSizeHandle" is set but when executing "DllCall('wininet.dll', 'int', 'FtpGetFileSize', 'long', $ai_FTPGetSizeHandle[0])" command it produces an Autit Error and

stop the script.

Does someone has any idea to fix that ?

Thanks for your help,

FreeRider

#cs===============================================================================
     Function Name: _FTPGetFileSize()
     Description:     Gets filesize of a file on the FTP server.
     Parameter(s):   $l_FTPSession  - The Long from _FTPConnect()
                       $s_FileName  - The file name.
     Requirement(s):   DllCall, wininet.dll
     Return Value(s):  On Success - 1
                       On Failure - 0
     Author(s):     J.o.a.c.h.i.m. d.e. K.o.n.i.n.g.
    #ce===============================================================================
    Func _FTPGetFileSize($l_FTPSession, $s_FileName)

        Local $ai_FTPGetSizeHandle = DllCall('wininet.dll', 'int', 'FtpOpenFile', 'long', $l_FTPSession, 'str', $s_FileName, 'long', 0x80000000, 'long', 0x04000002, 'long', 0)
        Local $ai_FTPGetFileSize = DllCall('wininet.dll', 'int', 'FtpGetFileSize', 'long', $ai_FTPGetSizeHandle[0])
        If @error OR $ai_FTPGetFileSize[0] = 0 Then
            SetError(-1)
            Return 0
        EndIf
        DllCall('wininet.dll', 'int', 'InternetCloseHandle', 'str', $ai_FTPGetSizeHandle)
        Return $ai_FTPGetFileSize
    EndFunc;==> _FTPGetFileSize()
Edited by Christophe Savard

FreeRiderHonour & Fidelity

Share this post


Link to post
Share on other sites



Hi all,

I'm trying to use the _FTPGetFileSize function found in a FTP.au3 file and it doesn't work...

Not all FTP sites return the size of their files. So in case "no size is returned" simply ignore such ftp server bahaviour :)

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

Hi Rudi,

The problem is when I use the _FtpFindFileFirst... The size is returned into the array.

This is actually the only way I found to bypass the _FtpGetFileSize "malfunction" but it takes much more time.

Thanks anyway for your answer.


FreeRiderHonour & Fidelity

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0