Sign in to follow this  
Followers 0
Azazash

FTP Upload Issue

1 post in this topic

*This was posted in the FTP UDF thread in error, many apologies to the mods*

I am having a strange problem with the FTP UDF and i can't for the life of me find out why it is happening.

I have a script that is supposed to scan a folder for any file beginning with the letter L and upload it to our FTP server. However it seems to only copy 1 of the 7 files it is supposed to be sending.

My code is as follows.

#include <FTP.au3>

#Region FTP Upload
   $fFTPUpload = GUICreate("",$fWidth, $lHeight, -1, -1,$WS_POPUP + $WS_BORDER,-1,$maintenance)
    $bSave = GUICtrlCreateButton("Upload",315,200, 75, 25, 0)
      GUICtrlSetOnEvent(-1,"FTPStart")
    $file = FileOpen(@scriptdir&"\Install\Lexacom.ini",0)
    $ftPath= FileReadLine($file,3)
    FileClose($file)
    $files = _FileListToArray($ftPath,'L*',1)
   GUICtrlCreateGroup("",5,0,400,240)
#endregion

#region FTP Upload Funcs
   Func FTPStart()
    Dim $server = "xxxx"
    Dim $username = "xxxx"
    Dim $pass = "xxxx"
    Dim $port = 21
    Dim $dllhandle = DllOpen('wininet.dll')
    Dim $Open = _FTPOpen('MyFTP')
    Dim $Conn = _FTPConnect($Open, $server, $username, $pass, $port)
    Global Const $INTERNET_FLAG_PASSIVE = 0x08000000
    Global Const $INTERNET_FLAG_TRANSFER_ASCII = 0x00000001
    Global Const $INTERNET_FLAG_TRANSFER_BINARY = 0x00000002
    
    if @error Then
        MsgBox(0,"Error", "No files were found",5)  
    EndIf
    for $i = 1 to $files[0]
        Dim $Ftpp = _FtpPutFile($Conn, $files[$i], '/httpdocs/incoming/'&$Company&' - '&$serial&' - '&$files[$i], $INTERNET_FLAG_TRANSFER_BINARY)
        ConsoleWrite($files[$i]&' - '&$ftpp&@crlf)
        sleep(500)
    Next
 ;~  ----------------------------------
    $lasterror = DllCall("kernel32.dll","int","GetLastError")
    ConsoleWrite("LAST ERROR - "&$lasterror[0])
 ;~  ----------------------------------
    Dim $Ftpc = _FTPClose($Open)
    DllClose($dllhandle)
    EndFunc
#endregion

The Console output for the transfer is as follows:

LCLinks.lxd - 0

LCPools.lxd - 0

LCRegist.lxd - 0

LCSeats.lxd - 0

LCSeats.pln - 1

LCUsers.lxd - 0

LexClients.lxd - 0

LexConfigSys.lxd - 0

LAST ERROR - 0+>13:13:43 AutoIT3.exe ended.rc:0

As you can see the *.pln file is reporting something happening, which i can only assume means success, as the pln file does get uploaded, and the others fail.

Can anyone point me in the right direction for this as its proving to be a right hair puller :)

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