Zaklinadlo Posted May 24, 2010 Share Posted May 24, 2010 Hello everyone, I searched a lot but I can't find anywhere an answer to my problem... I'm simply trying to upload an ".htm" file to my website using AutoIt3. But it doesn't work at all! Here is my code: $server = 'ftp://mywebsite.net' $username = 'myusername' $pass = 'mypassword' $Open = _FTPOpen('MyFTP Control') $Conn = _FTPConnect($Open, $server, $username, $pass) $Ftpp = _FtpPutFile($Conn, $mypath&"\logfiles"&$date&".htm", "/path/sub/logfiles"&$date&".htm") $Ftpc = _FTPClose($Open) Did I do something wrong? Thank you for your help. Link to comment Share on other sites More sharing options...
l3ill Posted May 24, 2010 Share Posted May 24, 2010 did you remember to #include... #include <FTPEx.au3> ;-) My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Zaklinadlo Posted May 24, 2010 Author Share Posted May 24, 2010 Wow, that was fast! I downloaded the FTP.au3 file and included it... Do I need the Ex one? Link to comment Share on other sites More sharing options...
l3ill Posted May 24, 2010 Share Posted May 24, 2010 I always just use the default one included with the AutoIT download package. My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Zaklinadlo Posted May 24, 2010 Author Share Posted May 24, 2010 (edited) Ok, thank you, I realised that I got an old version of AutoIt3... Names of functions are changed, but no more results :S $server = 'ftp://mywebsite.net' $username = 'myusername' $pass = 'mypassword' $Open = _FTP_Open('MyFTP Control') $Conn = _FTP_Connect($Open, $server, $username, $pass) $Ftpp = _FTP_FilePut($Conn, $mypath&"\logfiles"&$date&".htm", "/path/sub/logfiles"&$date&".htm") $Ftpc = _FTP_Close($Open) Edited May 24, 2010 by Zaklinadlo Link to comment Share on other sites More sharing options...
l3ill Posted May 24, 2010 Share Posted May 24, 2010 (edited) Try this before we start debugging to see if you can upload a file at all with your settings Edited: this should work #include <FTPEx.au3> Global $l_FTPSession, $sFilePath, $s_RemotePath, $Open $server = '' $username = '' $pass = '' $Open = _FTP_Open('MyFTP') $l_FTPSession = _FTP_Connect($Open, $server, $username, $pass) $sFilePath = FileOpenDialog ( "FTP Upload", @DesktopDir, "All Files (*.*)") If NOT @Error Then $sFileName = StringRegExpReplace($sFilePath, ".+\\(.*\..*)$", "/$1") _FTP_FilePut($l_FTPSession, $sFilePath, $s_RemotePath & $sFileName) _FTP_ProgressUpload($l_FTPSession, $sFileName, $s_RemotePath) EndIf Edited May 24, 2010 by billo My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Zaklinadlo Posted May 24, 2010 Author Share Posted May 24, 2010 (edited) I tried and got that:C:\Users\Andre\Documents\AutoIt\test.au3(13,82) : ERROR: syntax error (illegal character) $sFileName = StringRegExpReplace($sFilePath, ".+\\(.*\..*){:content:}quot;, "/$1" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^C:\Users\Andre\Documents\AutoIt\test.au3 - 1 error(s), 0 warning(s)EDIT: Okay, got it to work... Trying...EDIT2: I selected a file but it's not on my FTP... But when i'm using my FTP software it works, i don't understand why it doesn't with AutoIt... Edited May 24, 2010 by Zaklinadlo Link to comment Share on other sites More sharing options...
l3ill Posted May 24, 2010 Share Posted May 24, 2010 I had this problem once before, the forum code messes up a piece of the posted code. fixed now, try again... My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Zaklinadlo Posted May 24, 2010 Author Share Posted May 24, 2010 Isnt it the same thing? >Still not working. Link to comment Share on other sites More sharing options...
l3ill Posted May 24, 2010 Share Posted May 24, 2010 If you were too quick it was.. I posted twice now and both times were messed up. It's correct now ... My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Zaklinadlo Posted May 24, 2010 Author Share Posted May 24, 2010 Okay, I see the difference... But still not working :@ Link to comment Share on other sites More sharing options...
l3ill Posted May 24, 2010 Share Posted May 24, 2010 If you used the code as is then there must be some issue with your login info. I use this format "http://www.mywebsite.net" My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Zaklinadlo Posted May 24, 2010 Author Share Posted May 24, 2010 No results... Link to comment Share on other sites More sharing options...
l3ill Posted May 24, 2010 Share Posted May 24, 2010 You are changing this before running aren't you? $server = '' $username = '' $pass = '' My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Zaklinadlo Posted May 24, 2010 Author Share Posted May 24, 2010 Lol yes I am. Link to comment Share on other sites More sharing options...
l3ill Posted May 24, 2010 Share Posted May 24, 2010 the error has to be there somewhere, just play around with your login: I just tried: "ftp.mywebsite.net" and it worked too. My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Zaklinadlo Posted May 24, 2010 Author Share Posted May 24, 2010 (edited) I verified and _FTP_Connect() returns an error. Edited May 24, 2010 by Zaklinadlo Link to comment Share on other sites More sharing options...
l3ill Posted May 24, 2010 Share Posted May 24, 2010 Paste this under the FTP session var If @error Then MsgBox(0, "Connection", "Connect Error") Exit Else MsgBox(0, "Connection", "Connection Success", 1) EndIf My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
Zaklinadlo Posted May 24, 2010 Author Share Posted May 24, 2010 (edited) A second too late With "http://www.mywebsite.com" I got an error. With "ftp.mywebsite.com" it's okay but the file doesn't upload. No error on FileOpenDialog too. ERROR on _FTP_FilePut and _FTP_ProgressUpload. Edited May 24, 2010 by Zaklinadlo Link to comment Share on other sites More sharing options...
l3ill Posted May 24, 2010 Share Posted May 24, 2010 (edited) Make sure your looking in the root folder of your site...unless you changes the remote path var. did you ever get around to updating your autoit version. Edited May 24, 2010 by billo My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example 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