Jump to content

How can I use FTP?


Recommended Posts

Hey autoIT community!

I am having a bit of trouble, I am trying to communicate with my FTP server to upload a file, I have tried this script, but it won't work:

 

#include <FTPEx.au3>
Func FTP()
    $server = 'ftp.myftphost.com'
    $username = 'MyFtpUsername'
    $pass = 'MyFtpPassword'

    $Open = _FTP_Open('MyFTP Control')
    $Conn = _FTP_Connect($Open, $server, $username, $pass)
    $Ftpp = _FTP_FilePut($Conn, 'C:\Users\MyUserName\Desktop\test.au3', '/htdocs')
    $Ftpc = _FTP_Close($Open)
    Exit
EndFunc

 

I don't understand why it won't work, all of the ftp credentials are correct...

If someone could help me it would be real nice.

Thanks :D

Edited by thejtr
Link to comment
Share on other sites

Hey autoIT community!

I am having a bit of trouble, I am trying to communicate with my FTP server to upload a file, I have tried this script, but it won't work:

 

#include <FTPEx.au3>
Func FTP()
    $server = 'ftp.myftphost.com'
    $username = 'MyFtpUsername'
    $pass = 'MyFtpPassword'

    $Open = _FTP_Open('MyFTP Control')
    $Conn = _FTP_Connect($Open, $server, $username, $pass)
    $Ftpp = _FTP_FilePut($Conn, 'C:\Users\MyUserName\Desktop\test.au3', '/htdocs')
    $Ftpc = _FTP_Close($Open)
    Exit
EndFunc

 

I don't understand why it won't work, all of the ftp credentials are correct...

If someone could help me it would be real nice.

Thanks :D

All of your code is in the ftp function.... Do you ever actually call that function? 

Edited by kaisies
Link to comment
Share on other sites

The @Error is very good on that UDF to help find the problem.  It looks like you found it without but had you put error checking in you could have seen your error started right at the connection phase.

As for your firewall, is this something only admins will run so you can use #RequireAdmin or will non admin accounts need to run it?  You may want to add the proper firewall exceptions if that is the case.  An example of my FTP exception that is run when I install the FTP script.

Run(@WindowsDir & "\sysnative\cmd.exe /c netsh firewall set allowedprogram program = " & '"C:\Tiburon\MapFTP\Download Map Update.exe"' & " name = MapDownload mode = enable profile = all")

 

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

×
×
  • Create New...