Jump to content

FTP not sending file


Recommended Posts

For some reason the following code doesn't work.

I'm able to ftp to my local FTP server using FireFTP (Firefox plugin) in passive mode without a problem so I know the password, username and port is correct. I can upload and download no problems with it as well so I know it's not a problem with the local server. The test file I'm using exists (used in the FireFTP tests), however, I keep getting a FTPPut error from the code below.

#include <FTP.au3>
$server = "192.168.0.100"
$username = "guest"
$pass = "123456"
$port = 21
$passive = 0x08000000

$dllhandle = DllOpen('wininet.dll')
If $dllhandle = -1 Then MsgBox(262160, "ERROR", "DLL problem")

$Open = _FTPOpen('MyFTP Control')
If @error Then MsgBox(262160, "ERROR", "FTPOpen problem")

$Conn = _FTPConnect($Open, $server, $username, $pass, $port, 1 ,$passive)
If @error Then MsgBox(262160, "ERROR", "FTPConnect problem")

$Ftpp = _FtpPutFile($Conn, "C:\test.txt", "/test.txt")
If Not $Ftpp Then MsgBox(262160, "ERROR", "FTPPut problem")

$Ftpc = _FTPClose($Open)
DllClose($dllhandle)

I'm using Windows XP SP3 and AutoIt 3.2.12.0 if that makes any difference. Any ideas?

Thanks.

Link to comment
Share on other sites

When i try by using the code below i dont get any errors.

#include <FTP.au3>
$server = "192.168.0.100"
$username = "guest"
$pass = "123456"
$port = 21
$passive = 0x08000000

$dllhandle = DllOpen('wininet.dll')
If $dllhandle = -1 Then MsgBox(262160, "ERROR", "DLL problem")

$Open = _FTPOpen('MyFTP Control')
If @error Then MsgBox(262160, "ERROR", "FTPOpen problem")

$Conn = _FTPConnect($Open, $server, $username, $pass, $port ,$passive)
If @error Then MsgBox(262160, "ERROR", "FTPConnect problem")

$Ftpp = _FtpPutFile($Conn, "C:\test.txt", "/test.txt")
If Not $Ftpp Then MsgBox(262160, "ERROR", "FTPPut problem")

$Ftpc = _FTPClose($Open)
DllClose($dllhandle)

Your code seems to error on the connection string, i removed the '1' after $port and it seems to stop the error, not sure what that 1 is for.

Edited by Azazash
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...