Sign in to follow this  
Followers 0
RadoiCatalin

upload ftp

20 posts in this topic

Is there any way to make a script to upload and download using FTP protocol? If there is, tell me how...???

Share this post


Link to post
Share on other sites

#2 ·  Posted (edited)

Look at _FTPPutFile() in this UDF: http://www.autoitscript.com/forum/index.ph...ost&id=3314

Of course you'll need to use the other functions there to connect, open, and such.

Edited by sandman

[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites

when i use FTPConnect() return 0 and set error to -1 and i don't know what mean "-1", can someone tell me?

#include <Ftp.au3>

$server = 'my.ftp.server'

$username = 'username'

$pass = 'password'

$Open = _FTPOpen('MyFTP Control')

MsgBox(-1, "Open", $Open)

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

If @error Then

MsgBox(-1,"eroare",@error)

EndIf

MsgBox(-1, "Connect", $Conn)

$dir = _FTPMakeDir($Conn, 'test2')

MsgBox(-1, "Dir", $dir)

$Ftpp = _FtpPutFile($Conn, @ScriptDir & "\Temp\print.prt", '\test')

MsgBox(-1, "File", $Ftpp)

$Ftpc = _FTPClose($Open)

MsgBox(-1, "Close", $Ftpc)

wehn i've run it i've check the values returned and this are: $open <>0 $conn=0 $dir=0 $Ftpp=0 Ftpc=0

here is Ftp.au3 atached

Ftp.au3

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

The Autoit Help Guide explains all of that.

and the 0, -1 thing is just basic programming....

And there's no real way to check your method since your server is my.ftp.server, which isn't a real server..

Edited by CrewXp

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

The Autoit Help Guide explains all of that.

and the 0, -1 thing is just basic programming....

And there's no real way to check your method since your server is my.ftp.server, which isn't a real server..

The Autoit Help Guide doesn't contain informations about these function...

here is the real server with user and password

#include <Ftp.au3>

$server = 'radoi.agentimobiliar.com'

$username = 'radoi.agentimobiliar.com'

$pass = 'mormaici'

$Open = _FTPOpen('MyFTP Control')

MsgBox(-1, "Open", $Open)

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

If @error Then

MsgBox(-1,"eroare",@error)

EndIf

MsgBox(-1, "Connect", $Conn)

$dir = _FTPMakeDir($Conn, 'test2')

MsgBox(-1, "Dir", $dir)

$Ftpp = _FtpPutFile($Conn, @ScriptDir & "\Temp\print.prt", '\test')

MsgBox(-1, "File", $Ftpp)

$Ftpc = _FTPClose($Open)

MsgBox(-1, "Close", $Ftpc)

Edited by RadoiCatalin

Share this post


Link to post
Share on other sites

noob,

PLEASE tell me you just didn't post private ftp account information to a public forum????


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

Oh my... we didn't really need the password part of it.


[center]"Yes, [our app] runs on Windows as well as Linux, but if you had a Picasso painting, would you put it in the bathroom?" -BitchX.com (IRC client)"I would change the world, but they won't give me the source code." -Unknownsite . blog . portfolio . claimidcode.is.poetry();[/center]

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

noob,

PLEASE tell me you just didn't post private ftp account information to a public forum????

I use these ftp acount only for make test...and there is no problem if someone use it or ...it's a free acount. i can make many other.

Please help with the problem....

Edited by RadoiCatalin

Share this post


Link to post
Share on other sites

pls help me

Share this post


Link to post
Share on other sites

Help you what?

If you want robust ftp support, you need a robust ftp client. No one as of yet AFAIK has written a native solution.

my standard response to problems of this ilk:


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

You'l have to use DllOpen('wininet.dll') before using specific FTP functions.

Like this code :

#include <FTP.au3>

$server = 'server'

$username = 'yyyy'

$pass = 'xxxxx'

$dllop=DllOpen('wininet.dll')

$Open = _FTPOpen('test_FTP')

MsgBox(0,'deschidere',$Open)

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

MsgBox(0,'conexiune',$Conn)

$Ftpp = _FtpPutFile($Conn, 'mcm.png', 'ftp_pub/mcm.png')

MsgBox(0,'transfer',$Ftpp)

$Ftpc = _FTPClose($Open)

MsgBox(0,'inchidere',$Ftpc)

DllClose($dllop)

Leos- Oradea

Share this post


Link to post
Share on other sites

You'l have to use DllOpen('wininet.dll') before using specific FTP functions.

Like this code :

#include <FTP.au3>

$server = 'server'

$username = 'yyyy'

$pass = 'xxxxx'

$dllop=DllOpen('wininet.dll')

$Open = _FTPOpen('test_FTP')

MsgBox(0,'deschidere',$Open)

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

MsgBox(0,'conexiune',$Conn)

$Ftpp = _FtpPutFile($Conn, 'mcm.png', 'ftp_pub/mcm.png')

MsgBox(0,'transfer',$Ftpp)

$Ftpc = _FTPClose($Open)

MsgBox(0,'inchidere',$Ftpc)

DllClose($dllop)

Leos- Oradea

doesn't work

Share this post


Link to post
Share on other sites

Well it worked for me. Guess you're just not cut out for this whole programming thing.

Tip: You did alter his EXAMPLE to suit your own server and files, right?

Share this post


Link to post
Share on other sites

Well it worked for me. Guess you're just not cut out for this whole programming thing.

Tip: You did alter his EXAMPLE to suit your own server and files, right?

Yes you're right.

Share this post


Link to post
Share on other sites

UP

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

You'l have to use DllOpen('wininet.dll') before using specific FTP functions.

Like this code :

#include <FTP.au3>

$server = 'server'

$username = 'yyyy'

$pass = 'xxxxx'

$dllop=DllOpen('wininet.dll')

$Open = _FTPOpen('test_FTP')

MsgBox(0,'deschidere',$Open)

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

MsgBox(0,'conexiune',$Conn)

$Ftpp = _FtpPutFile($Conn, 'mcm.png', 'ftp_pub/mcm.png')

MsgBox(0,'transfer',$Ftpp)

$Ftpc = _FTPClose($Open)

MsgBox(0,'inchidere',$Ftpc)

DllClose($dllop)

Leos- Oradea

Thanks a lot, I met a exactly same problem as RadoiCatalin, as I tried this method, it does work!! Many thanks

and, can leostell us why we should add the code: $dllop=DllOpen('wininet.dll') and DllClose($dllop), I do not have any experence at call a dll with AutoIt

Edited by chenxu

Share this post


Link to post
Share on other sites

and, I successfully connect to a ftp directly, and I tried to connect to another ftp server by http proxy, I failed! the code as follow, sorry for that I can not just post the real ftp ip here,

CODE

$dllop=DllOpen('wininet.dll')

;~ $outerFtp = _FTPOpen("proxysh.zte.com.cn:80", 1, "proxysh.zte.com.cn:80")

$outerFtp = _FTPOpen("proxysh.zte.com.cn:80")

ConsoleWrite($outerFtp & @CRLF)

If @error == -1 Then

ConsoleWrite("open ftp failed!" & @CRLF)

EndIf

$outerFtpConn = _FTPConnect($outerFtp, "my.ftp.com", "name", "pwd", 21)

;~ $outerFtpConn = _FTPConnect($outerFtp, "10.40.70.170", "rmtctrl", "rmtctrl", 2121)

If $outerFtpConn == 0 Then

ConsoleWrite("conn ftp failed!" & @CRLF)

EndIf

_FTPPutFile($outerFtpConn, "E:\AutoItWork\RemoteControl\CmdLine.txt", "cx\CmdLine.txt")

If @error == -1 Then

ConsoleWrite("put file failed!" & @CRLF)

EndIf

_FTPClose($outerFtp)

DllClose($dllop)

Share this post


Link to post
Share on other sites

can leostell us why we should add the code: $dllop=DllOpen('wininet.dll') and DllClose($dllop), I do not have any experence at call a dll with AutoIt

Neither I.

Having myself same problem, I a have found this solution, 1 month ago, by searching the forum.

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

Thanks a lot, I met a exactly same problem as RadoiCatalin, as I tried this method, it does work!! Many thanks

and, can leostell us why we should add the code: $dllop=DllOpen('wininet.dll') and DllClose($dllop), I do not have any experence at call a dll with AutoIt

Look here for explanation from developers.

Edited by Zedna

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  
Followers 0