Jump to content
Sign in to follow this  

FTPConnect and _FtpPutFile isn't working

Recommended Posts

Hi! im trying to create a sc ript that would transfer a file from localhost to the ftp.

however FTPConnect and _FtpPutFile isn't working.

probably i missed some important lines etc.

could you help me? thanks :huh2:

the code is shown below.

note: we didn't require username and password to access the ftp so uname and password was given no value.


$__ftp_hWinInetDll = DllOpen( 'wininet.dll' )
If $__ftp_hWinInetDll == -1 Then
    ConsoleWrite( "-- ERROR FROM FTP.au3: Unable to open WinInet.dll" & @LF )
    $__ftp_hWinInetDll = 'wininet.dll'

$server = 'ftp://***.***.**.***/'
$username = ''
$pass = ''

$Open = _FTPOpen('MyFTP Control')
$Conn = _FTPConnect($Open, $server, $username, $pass)
$Ftpp = _FtpPutFile($Conn, 'C:\*******\net.txt', '/sample.txt')
$Ftpc = _FTPClose($Open)

Share this post

Link to post
Share on other sites

If you web host is like mine, your problem may be on the the line for _FTP_FilePut. My website is not hosted in the root of the directory. It is in a folder that is named after my user login name. Here's part of a script I use (had to change some stuff for privacy purposes):

$server = 'mywebsite.com'
$username = 'userxxx'
$pass = '********'

$Open = _FTP_Open('MyFTP Control')
$Conn = _FTP_Connect($Open, $server, $username, $pass)

_FTP_FilePut($Conn, @DesktopDir & "\FTP_Folder\file.txt", "\userxxxx\" & "file.txt")

$Ftpc = _FTP_Close($Open)

#include <ByteMe.au3>

Share this post

Link to post
Share on other sites

hi sleepydvdr , i tried using FTPEx.au3 instead of FTP.au3 and followed every syntax you got there in your code but it produced more error.

I tried fixing it by downloading fileconstants.au3 and winapiError.au3, since some part of the code was looking for that ,

but it was still resulting to errors. Do you have any idea how to fix this?

or probably any idea what went wrong with the code i posted before?


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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...