sundeep Posted April 7, 2009 Share Posted April 7, 2009 Hi,I digged into almost all the posts related to FTP for no luck , On calling the FTPPutFile, it returns 0.I think I have included all the necessary stuff such as wininet.dll etc. I am able to Open the Connection and Connect to the remote FTP server successfully.Can you please point me out the mistake I am committing in the below code:#include <FTP.au3>$close = DllOpen('Wininet.dll')$server = 'ip address'$username = 'username'$pass = '******'MsgBox(1,"Hi",$close)$Open = _FTPOpen('MyFTP','','','',1)MsgBox(1,"Hi",$Open)Sleep(300)$Conn = _FTPConnect($Open, $server, $username, $pass, 0, 1, 0x08000000,0)MsgBox(1,"Conn",$Conn)Sleep(300)$Ftpp = _FTPPutFile($Conn, 'C:\WINDOWS\Notepad.exe', '/back/')MsgBox(1,"End", $Ftpp)$Ftpc = _FTPClose($close)Thanks in advance Link to comment Share on other sites More sharing options...
Tvern Posted April 7, 2009 Share Posted April 7, 2009 (edited) Hi, I digged into almost all the posts related to FTP for no luck , On calling the FTPPutFile, it returns 0. I think I have included all the necessary stuff such as wininet.dll etc. I am able to Open the Connection and Connect to the remote FTP server successfully. Can you please point me out the mistake I am committing in the below code: Thanks in advance I can't test it at the moment, but I am using the same functions in a script of mine. The difference being that I used: $Open = _FTPOpen('MyFTP Control') $Conn = _FTPConnect($Open, $ServerName, $Username, $Password) _FTPClose($Open) DllClose($Close) Also "wininet.dll" is all lowercase, but I am not sure it's case sensitive. (guess it's not if _FTPOpen() works. Have you tried testing the script without the special flags? (I'm not sure what they do, or how badly you need them, but they seem to be the major difference between our scripts.) P.S. use code tags. Some users won't respond to posts with a bunch of raw code in it. edit: oh and make sure your directories exist, or are created and capitalised correctly. Edited April 7, 2009 by Tvern Link to comment Share on other sites More sharing options...
sundeep Posted April 9, 2009 Author Share Posted April 9, 2009 Hi, Ya, had tested removing the special flags. Someone had posted that it worked when they added the special flags. So, even I added(copy cat) . _FTPOpen() is not creating any problem because its opening and connecting to the server. I am facing problem only in uploading the files i.e., ftpput(). All the files are present in the working directory....No clue, what is creating the problem Link to comment Share on other sites More sharing options...
martin Posted April 9, 2009 Share Posted April 9, 2009 Hi, I digged into almost all the posts related to FTP for no luck , On calling the FTPPutFile, it returns 0. I think I have included all the necessary stuff such as wininet.dll etc. I am able to Open the Connection and Connect to the remote FTP server successfully. Can you please point me out the mistake I am committing in the below code: #include <FTP.au3> $close = DllOpen('Wininet.dll') $server = 'ip address' $username = 'username' $pass = '******' MsgBox(1,"Hi",$close) $Open = _FTPOpen('MyFTP','','','',1) MsgBox(1,"Hi",$Open) Sleep(300) $Conn = _FTPConnect($Open, $server, $username, $pass, 0, 1, 0x08000000,0) MsgBox(1,"Conn",$Conn) Sleep(300) $Ftpp = _FTPPutFile($Conn, 'C:\WINDOWS\Notepad.exe', '/back/') MsgBox(1,"End", $Ftpp) $Ftpc = _FTPClose($close) Thanks in advance I'm not sure that this will work- [b][color="#0000ff"]$Ftpp = _FTPPutFile($Conn, 'C:\WINDOWS\Notepad.exe', '/back/')[/color][/b] but when I use _FTPPutFile I always specify the file to be written, and I also always add the flag as follows [color="#000000"]$Ftpp = _FTPPutFile($Conn, 'C:\WINDOWS\Notepad.exe', '/back/Notepad.exe',0x08000000)[/color] Don't forget that names on the server are probably case sensitive. Also, try with some other file name in case the server doesn't allow exe files. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
sundeep Posted April 13, 2009 Author Share Posted April 13, 2009 I tried it dude, for no luck :-( Link to comment Share on other sites More sharing options...
wysocki Posted June 4, 2009 Share Posted June 4, 2009 On my system, I had problems until I found out the local file was in use by another app. When I closed the other app, the xfer worked. Also, the destination filename must be spelled out, you can't just use the destination directory name. Try simplifying your parameters by sending a simple file from your root drive to the root of the server like this: $Ftpp = _FtpPutFile($Conn, 'c:\test.htm', '/test.htm') Link to comment Share on other sites More sharing options...
Yashied Posted June 4, 2009 Share Posted June 4, 2009 (edited) #Include <FTP.au3> Const $Host = '' Const $Login = '' Const $Password = '' Const $LocalFile = 'C:\WINDOWS\Notepad.exe' Const $RemoteFile = 'Notepad.exe' Local $hFtp, $hSession _FTP_Startup() ConsoleWrite(@error & @CR) $hFtp = _FTP_Open('MyFtp') ConsoleWrite(@error & @CR) $hSession = _FTP_Connect($hFtp, $Host, $Login, $Password) ConsoleWrite(@error & @CR) _FTP_PutFile($hSession, $LocalFile, $RemoteFile) ConsoleWrite(@error & @CR) _FTP_Disconnect($hSession) _FTP_Close($hFtp) _FTP_Shutdown()Use this FTP.au3.If you are not working, the problem in your FTP-server. Check mode (active or passive), port (default is 21), etc., dude. Edited June 4, 2009 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... 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