Jump to content

Downloading From Ftp


Recommended Posts

  • Moderators

I am not sure what is happening here. I don't seem to be able to find a script to download from FTP and there InetGet doesn't work on this FTP server.

Help?

http://www.autoitscript.com/forum/index.ph...ic=23971&hl=ftp

_FTPGetFile() I believe, his script has it... although I don't think we ever got the progress bar to work.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Hmm...

I figure ftpget should work like this:

Does it not?

Your second parameter doesn't look right, there's no path to the file, your 3rd parameter should at leaset have the directory your going to install it on don't you think? Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

Same directory.

Yeah, but... have you tried giving it the full directory? Better yet... What all have you tried... I was able to get the other example to download myself.... so it must be on your end, or the other.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Alright.

Try to download "live.txt" from "sweangels.no-ip.com:24". Username is "test" and password is "test1".

I don't believe you can include the port as part of the domain, you have to include the port as a connection parameter.

You need to use _FTPOpen() to open a sesion then _FTPConnect() to the handle assigned by the $handle = _FTPOpen() call. The port to connect to is a parameter of _FTPConnect(). Use the connection handle $connection = _FTPConnect() for the download operation.

The connect function is documented with the parameters including the port.

Link to comment
Share on other sites

I try:

$username = "test"

$password = "test1"

$server = "sweangels.no-ip.com:24"

$Open = _FTPOpen ('MyFTP Control')

$Conn = _FTPConnect ($Open, $server, $username, $password)

$Ftgf = _FtpGetFile ($Conn, '/live.txt', 'live.txt')

$Ftpc = _FTPClose ($Open)

And I get nada.

Link to comment
Share on other sites

Alright, I see... lol.

Further refined:

$username = "test"

$password = "test1"

$server = "sweangels.no-ip.com"

$Open = _FTPOpen ('MyFTP Control')

$Conn = _FTPConnect ($Open, $server, $username, $password, 24)

$Ftgf = _FtpGetFile ($Conn, '/live.ini', 'live.ini', 2, 0, 0, 0)

$Ftpc = _FTPClose ($Open)

No go.

Link to comment
Share on other sites

  • Moderators

do you have a valid username and password to test?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Username: test

Password: test1

The software creates the file that I am trying to get (a 0 byte file) in the directory specified by there never gets to be more then 0 bytes in that file and it just idles until the server d/cs you.

Help?

Link to comment
Share on other sites

Username: test

Password: test1

The software creates the file that I am trying to get (a 0 byte file) in the directory specified by there never gets to be more then 0 bytes in that file and it just idles until the server d/cs you.

Help?

Try setting the transfer mode to ASC (if it is indeed an ASCII ini file) and if you are behind a firewall/router, set the connection mode to PASSIVE.

Under a normal connection the FTP server initiates the transfer/dialogue, but if you are behind a firewall (router, NAT), the server can't determine your location, so passive mode is used to have the client (your sytem) initiate the dialogue, and the server responds.

I have seen many connection issues due to this with MS FTP.exe since it doesn't support passive transfers.

Link to comment
Share on other sites

Heh...

I am gonna have to ask how to set it to passive mode and ASC... I thought it was already in ASC but how can you set it to passive?

$Open = _FTPOpen ('MyFTP Control')
$Conn = _FTPConnect ($Open, $server, $username, $password, 24)
$Ftgf = _FtpGetFile ($Conn, '/live.ini', 'live.ini', 1, 0, 0, 0)
$Ftpc = _FTPClose ($Open)

That even remotely close? lol.

Edited by Shyke
Link to comment
Share on other sites

Heh...

I am gonna have to ask how to set it to passive mode and ASC... I thought it was already in ASC but how can you set it to passive?

on the _FTPConnect() function set the $l_Flags parameter to 0x08000000, and

in the _FTPGetFile() function set

$l_Flags

; - 1 for transferring the file in ASCII (Type A transfer method) or

; - 2 for transferring the file in Binary (Type I transfer method).

and

$l_Fail - Allow local file to be overwritten if it exists

; - -1 Don't allow overwrite (default)

; - 0 Allow overwrite

The functions have the transfer default as binary, active transfer, and don't overwrite existing file. These are documented in the functions in the udf.

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...