Jump to content

Recommended Posts

Good Evening,

I am trying to send a log file to my Web hoster (unsure if that is the correct terminology) using the AutoIT FTP functions.

I can Xfer files using Filezilla and can connect by specifying the URL in IE's address bar but cannot connect with AutoIT.

Called the hoster and asked if they could see any inbound connection attempts and give me any failure/reject codes but they say that they cannot get that data (did not penetrate past the help desk, yet).

Found one hit and tried that solution to no avail. See comments in code.

;
;
;
#include <FTPEx.au3>
#include <array.au3>
local $st    = timerinit()
local $files[1]
local $file_list = f_search('c:\tmp\ftptest\log*')
consolewrite('Time to list files    = ' & round(timerdiff($st)/1000,4) & @lf)
ConsoleWrite('Number of files found = ' & UBound($file_list) - 1 & @lf)
;_arraydisplay($file_list)
Local $server   = 'ftp://ehost-services170.com'
Local $username  = '*******'
Local $pass   = '********'
Local $Open = _FTP_Open('Samolyk FTP')
If $open = 0 Then
 MsgBox(0,'open error',@error)
 Exit
endif
; the following statement returns 0 in $Conn, @error is set to -1 and @extended is set to 12007
; 12007 equates to "ERROR_INTERNET_NAME_NOT_RESOLVED" (The server name could not be resolved.
; all of the following function calls failed with the same error
;Local $Conn = _FTP_Connect($Open, $server, $username, $pass)         <---- tried this initially
;Local $Conn = _FTP_Connect($Open, $server, $username, $pass, 1)       <---- found a post that offered this solution, no good
Local $Conn = _FTP_Connect($Open, $server, $username, $pass, 1, 21) ;  <---- current statement
If $conn = 0 Then
 MsgBox(0,'return from connect',@error & @LF & @extended)
 exit
endif
Local $put  = _FTP_FilePut($conn,$file_list[1],"")
If $put = 0 Then
 MsgBox(0,'',@error)
 exit
EndIf
Local $Ftpc = _FTP_Close($Open)
Func f_search ($s_dir)
 local $fls = FileFindFirstFile($s_dir)
 If @error = -1 Then msgbox(0,'Error','')
 While 1
  $next = FileFindNextFile($fls)
  If @error Then return($files)
  If Not @extended then
   $files[ubound($files)-1] = $s_dir & '\' & $next
   redim $files[ubound($files) + 1]
  EndIf
 WEnd
 FileClose($fls)
EndFunc

If I have to I will provide the account and password privately to get this resolved (if I recognize you as a regular).

Thanks,

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...