FreeRider Posted March 28, 2008 Posted March 28, 2008 (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 April 2, 2008 by Christophe Savard FreeRiderHonour & Fidelity
rudi Posted March 29, 2008 Posted March 29, 2008 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!
FreeRider Posted March 31, 2008 Author Posted March 31, 2008 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now