Sign in to follow this  
Followers 0
Zask3333

cant send file to ftp server

2 posts in this topic

Hello i'm trying to send a file named (file.log) in the temp folder to my ftp server but i cant get it to work, im not well known with the language autoit 
so it would be herry helpful if i can have some help to find the solution to my problem. I have a error that displays this.

...............................................................
. Line 22 (File "C:\Users\Jacob\AppData\Local\Temp\ftp.au3"): .
.                                                             .
. $Open = _FTPOpen("anything")                                . 
. $Open = ^ ERROR                                             . 
.                                                             .
. Error: Unknown function name.                               .
...............................................................

This is my code ~

...........................................................................................................

#include-once <FTP.au3>

$server = ""
$username = ""
$pass = ""
$sLocalFile = @TempDir & "\file.log"
$sRemoteFile = "/htdocs/upload/file.log"

;Local Const $INTERNET_FLAG_PASSIVE = 0x08000000
;Local Const $INTERNET_FLAG_TRANSFER_ASCII = 0x00000001
;Local Const $INTERNET_FLAG_TRANSFER_BINARY = 0x00000002
Local Const $WININET_API_FLAG_SYNC = 0x00000004


$Open = _FTPOpen("anything")
If Not FileExists( $sLocalFile ) Then
    MsgBox( 16 , "ERROR" , "File doesn't exist!" )
    Exit
EndIf


If @error Or Not $Open Then
    ConsoleWrite( "Error(" & @error & ") > Unable to initialize FTP.au3" & @LF )
    Exit
EndIf

$Conn = _FTPConnect($Open, $server, $username, $pass  );$INTERNET_FLAG_PASSIVE
If @error Or Not $Conn Then
    ConsoleWrite( "Error(" & @error & ") > Unable to establish the connection to "&$server & @LF )
    Exit
EndIf


$Ftpp = _FtpPutFile($Conn, $sLocalFile , $sRemoteFile );$WININET_API_FLAG_SYNC
If $Ftpp == 1 Then
    ConsoleWrite( "Transfer successful!" & @LF )
    Exit
EndIf
$Ftpc = _FTPClose($Open)


...........................................................................................................

Anyone know what the problem is? Thanks.

Share this post


Link to post
Share on other sites



I found this code online so i only have a slight understanding of what it does

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