RadoiCatalin Posted August 23, 2007 Share Posted August 23, 2007 Is there any way to make a script to upload and download using FTP protocol? If there is, tell me how...??? Link to comment Share on other sites More sharing options...
sandman Posted August 23, 2007 Share Posted August 23, 2007 (edited) Look at _FTPPutFile() in this UDF: http://www.autoitscript.com/forum/index.ph...ost&id=3314Of course you'll need to use the other functions there to connect, open, and such. Edited August 23, 2007 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] Link to comment Share on other sites More sharing options...
RadoiCatalin Posted August 23, 2007 Author Share Posted August 23, 2007 Look at _FTPPutFile() in this UDF: http://www.autoitscript.com/forum/index.ph...ost&id=3314Of course you'll need to use the other functions there to connect, open, and such.when i use FTPConnect() return 0 and set error to -1 and i don't know what mean "-1", can someone tell me?Ftp.au3 Link to comment Share on other sites More sharing options...
RadoiCatalin Posted August 23, 2007 Author Share Posted August 23, 2007 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 atachedFtp.au3 Link to comment Share on other sites More sharing options...
CrewXp Posted August 23, 2007 Share Posted August 23, 2007 (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 August 23, 2007 by CrewXp Link to comment Share on other sites More sharing options...
RadoiCatalin Posted August 23, 2007 Author Share Posted August 23, 2007 (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)EndIfMsgBox(-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 August 23, 2007 by RadoiCatalin Link to comment Share on other sites More sharing options...
flyingboz Posted August 23, 2007 Share Posted August 23, 2007 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. Link to comment Share on other sites More sharing options...
sandman Posted August 23, 2007 Share Posted August 23, 2007 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] Link to comment Share on other sites More sharing options...
RadoiCatalin Posted August 23, 2007 Author Share Posted August 23, 2007 (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 August 23, 2007 by RadoiCatalin Link to comment Share on other sites More sharing options...
RadoiCatalin Posted August 23, 2007 Author Share Posted August 23, 2007 pls help me Link to comment Share on other sites More sharing options...
flyingboz Posted August 23, 2007 Share Posted August 23, 2007 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. Link to comment Share on other sites More sharing options...
leos Posted August 24, 2007 Share Posted August 24, 2007 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 Link to comment Share on other sites More sharing options...
RadoiCatalin Posted August 25, 2007 Author Share Posted August 25, 2007 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- Oradeadoesn't work Link to comment Share on other sites More sharing options...
therks Posted August 25, 2007 Share Posted August 25, 2007 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? My AutoIt Stuff | My Github Link to comment Share on other sites More sharing options...
RadoiCatalin Posted August 28, 2007 Author Share Posted August 28, 2007 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. Link to comment Share on other sites More sharing options...
RadoiCatalin Posted August 30, 2007 Author Share Posted August 30, 2007 UP Link to comment Share on other sites More sharing options...
chenxu Posted August 31, 2007 Share Posted August 31, 2007 (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- OradeaThanks a lot, I met a exactly same problem as RadoiCatalin, as I tried this method, it does work!! Many thanksand, 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 August 31, 2007 by chenxu Link to comment Share on other sites More sharing options...
chenxu Posted August 31, 2007 Share Posted August 31, 2007 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) Link to comment Share on other sites More sharing options...
leos Posted August 31, 2007 Share Posted August 31, 2007 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 AutoItNeither I.Having myself same problem, I a have found this solution, 1 month ago, by searching the forum. Link to comment Share on other sites More sharing options...
Zedna Posted August 31, 2007 Share Posted August 31, 2007 (edited) Thanks a lot, I met a exactly same problem as RadoiCatalin, as I tried this method, it does work!! Many thanksand, 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 AutoItLook here for explanation from developers. Edited August 31, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now