Jump to content
Sign in to follow this  
Shyke

Downloading From Ftp

Recommended Posts

Shyke

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?

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
Shyke

Hmm...

I figure ftpget should work like this:

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

Does it not?

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
Shyke

Alright.

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

Share this post


Link to post
Share on other sites
billmez

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.

Share this post


Link to post
Share on other sites
Shyke

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.

Share this post


Link to post
Share on other sites
billmez

I try:

And I get nada.

I repeat:

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

Read the function description in the UDF.

Share this post


Link to post
Share on other sites
Shyke

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.

Share this post


Link to post
Share on other sites
Shyke

$username = "test"

$password = "test1"

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

InetGet("ftp://" & $username & ":" & $password & "@" & $server & "/live.ini", "live.ini", 1, 0)

Is a no go either.

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
Shyke

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?

Share this post


Link to post
Share on other sites
billmez

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.

Share this post


Link to post
Share on other sites
Shyke

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

Share this post


Link to post
Share on other sites
billmez

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.

Share this post


Link to post
Share on other sites
Shyke

YES!

Thank-you very much man guys!!

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.