Jump to content

upload ftp


Recommended Posts

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]

Link to comment
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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
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]

Link to comment
Share on other sites

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
Link to comment
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

Link to comment
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

Link to comment
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

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
Link to comment
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)

Link to comment
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.

Link to comment
Share on other sites

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