compact21 Posted May 15, 2014 Share Posted May 15, 2014 Hi, can anyone tell me what am i doing wrong? i can't get the file uploaded, what do i miss? #include <FTPEx.au3> Local $sServer = 'name.server.com' Local $sUsername = 'username' Local $sPass = 'password' Local $location = "/name.server.com/" Local $filename = "notepad.exe" Local $hOpen = _FTP_Open('MyFTP Control') Local $hConn = _FTP_Connect($hOpen, $sServer, $sUsername, $sPass) $put = _FTP_FilePut($hConn, @WorkingDir&"\"&$filename, $location & $filename) If $put Then traytip("Uploaded","The file has been uploaded!",15,3) Local $Ftpc = _FTP_Close($hConn) Local $Ftpo = _FTP_Close($hOpen) Sleep(2000) Exit Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 15, 2014 Moderators Share Posted May 15, 2014 Where is the script failing? What error checking have you put in place? I would check for @error after every FTP call, to find out where it is failing for you. Something like this: Local $hOpen = _FTP_Open('MyFTP Control') If @error Then ;<Do something> Local $hConn = _FTP_Connect($hOpen, $sServer, $sUsername, $sPass) If @error Then ;<Do something> $put = _FTP_FilePut($hConn, @WorkingDir&"\"&$filename, $location & $filename) If @error Then ;<Do something> "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
compact21 Posted May 15, 2014 Author Share Posted May 15, 2014 thanx for your answer, well the error is on _FTP_FilePut() function, how do i fix that? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted May 15, 2014 Moderators Share Posted May 15, 2014 What is it setting @error value to? "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
compact21 Posted May 15, 2014 Author Share Posted May 15, 2014 i'm not sure i understood what you mean, this is from the help file: Return Value Success: 1. Failure: 0 and sets the @error flag to non-zero. Link to comment Share on other sites More sharing options...
Palestinian Posted May 16, 2014 Share Posted May 16, 2014 Make sure you are allowed to upload files to the main directory of your website, also make sure your website's ftp allows .exe file upload. Link to comment Share on other sites More sharing options...
BrewManNH Posted May 16, 2014 Share Posted May 16, 2014 The FTP UDF doesn't work for SFTP sites, so if the site you're connecting to uses any type of SSH, you can't use the UDF with it. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
compact21 Posted May 16, 2014 Author Share Posted May 16, 2014 thanks for your answers, the thing is it worked just fine until 2 days ago, my pc is clean of viruses, i tryed to uninstall and reinstall autoit and beta, i've added an exception for autoit to my firewall, and still not working i tryed to upload the same file with filezilla and it worked so i don't think is the website... Link to comment Share on other sites More sharing options...
BrewManNH Posted May 16, 2014 Share Posted May 16, 2014 I think it might have been useful to mention that it worked at one time and now doesn't. That's an important point in the troubleshooting process. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
DicatoroftheUSA Posted May 17, 2014 Share Posted May 17, 2014 (edited) Try using to use _ftp_progressupload, which sends small chunks at a time. I had issues with FTP fileput uploading a large file. It would connect, upload, and disconnect for no appearent reason long before it was finished. I still don't quite understand why, but from what I could gather it is because of routers that try to actively end idle connections, and don't handle FTP connections correctly. Filezilla and windows explorer uploaded the file as expected. _ftp_fileput worked for me at first, but began to fail when the file grew. Edited May 17, 2014 by DicatoroftheUSA Statism is violence, Taxation is theft. Autoit Wiki Link to comment Share on other sites More sharing options...
compact21 Posted May 18, 2014 Author Share Posted May 18, 2014 (edited) @DictatoroftheUSA thanks, the problem was solved by reinstaling the OS, still don't know the error reason, anyway it works fine now. @ BrewManNH, thanks for the tip, it's been noted. Edited May 18, 2014 by compact21 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