Jump to content

FTPGetfile problem, FTP.au3 UDF


Recommended Posts

hi,

FTP.au3 UDF doesn't contain FTPGetFile, so I added it myself using the same proc that have been done for FTPputFile.

although the file is been uploaded to my computer from the FTP server, the script stuck for some reason that I can't understand.

can someone please help with this one?

lines added to FTP.au3

;===============================================================================
;
; Function Name:    _FTPGetFile()
; Description:    Gets a file on an FTP server.
; Parameter(s):  $l_FTPSession  - The Long from _FTPConnect()
;                  $s_LocalFile     - The local file.
;                  $s_RemoteFile      - The remote Location for the file.
;                  $l_Flags     - Special flags.
;                  $l_Context     - I dont got a clue what this does.
; Requirement(s):   DllCall, wininet.dll
; Return Value(s):  On Success - 1
;                  On Failure - 0
; Author(s):        Wouter van Kesteren
;
;===============================================================================

Func _FTPGetFile($l_FTPSession, $s_LocalFile, $s_RemoteFile, $l_Flags = 0, $l_Context = 0)

    Local $ai_FTPGetFile = DllCall('wininet.dll', 'int', 'FtpGetFile', 'long', $l_FTPSession, 'str', $s_LocalFile, 'str', $s_RemoteFile, 'long', $l_Flags, 'long', $l_Context)
    If @error OR $ai_FTPGetFile[0] = 0 Then
        SetError(-1)
        Return 0
    EndIf
    
    Return $ai_FTPGetFile[0]
    
EndFunc;==> _FTPGetFile()

this is the script using ftp.au3:

#include <FTP.au3>
$dllhandle = DllOpen('wininet.dll')
$server = '9.148.218.20'
$username = 'anonymous'
$pass = 's@s'
$port=21
$Open = _FTPOpen('MyFTP Control')
$Conn = _FTPConnect($Open, $server, $username, $pass,$port)
;$Ftpp = _FtpPutFile($Conn, 'C:\WINDOWS\Notepad.exe', '/pub/Notepad.exe')
$FTPG=_FTPGetFile($Conn,'/pub/46xxupgrade.scr','c:\46xxupgrade.scr')
$Ftpc = _FTPClose($Open)
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...