lifesux Posted September 16, 2011 Share Posted September 16, 2011 Hi guys i want a ftp script that i can upload some .jpg files to my host. Can you give the ftp code to me ? Thanks... Link to comment Share on other sites More sharing options...
rcmaehl Posted September 16, 2011 Share Posted September 16, 2011 Use: http://www.autoitscript.com/autoit3/docs/functions/FileOpenDialog.htm Then http://www.autoitscript.com/autoit3/docs/functions/FileCopy.htm to send the files returned from FileOpenDialog to the ftp server. My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
lifesux Posted September 16, 2011 Author Share Posted September 16, 2011 I have the directory. i need a ftp code. Link to comment Share on other sites More sharing options...
rcmaehl Posted September 16, 2011 Share Posted September 16, 2011 I have the directory. i need a ftp code.FTP is a directory. You don't need any special code. My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
lifesux Posted September 16, 2011 Author Share Posted September 16, 2011 Can you write the full code ? I am newbie at autoit. I want to transfer jpg files to my host... Link to comment Share on other sites More sharing options...
hannes08 Posted September 16, 2011 Share Posted September 16, 2011 I have the directory. i need a ftp code. Hello lifesux, Just take a look at the _FTP_*() Functions in the helpfile. I'm sure you only need a few commands: #include <FTPEx.au3> $server = 'ftp.csx.cam.ac.uk' $username = '' $pass = '' $Open = _FTP_Open('MyFTP Control') $Conn = _FTP_Connect($Open, $server, $username, $pass) _FTP_FilePut($Conn, $s_LocalFile, $s_RemoteFile) $Ftpc = _FTP_Close($Open) Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
rcmaehl Posted September 16, 2011 Share Posted September 16, 2011 Microsoft Windows has built in FTP for explorer. All you need is to open the directory using ftp://ftp.example.com (replace ftp.example.com with the ftp server you are using) and it will prompt you for the user name and pass once. Afterwards you can simply use filecopy() My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
hannes08 Posted September 16, 2011 Share Posted September 16, 2011 Well, he can't use that if he want's to automate it completely, right? Another thought would be using tools like ncftp or even the built in ftp in windows command shell. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
lifesux Posted September 16, 2011 Author Share Posted September 16, 2011 can you give example about that script:_FTP_FilePut($Conn, $s_LocalFile, $s_RemoteFile) Link to comment Share on other sites More sharing options...
hannes08 Posted September 16, 2011 Share Posted September 16, 2011 #include <FTPEx.au3> $server = 'ftp.yourserver.com' $username = 'username' $pass = 'mypassword' $Open = _FTP_Open('MyFTP Control') $Conn = _FTP_Connect($Open, $server, $username, $pass) _FTP_FilePut($Conn, "C:\pictures\image1.jpg", "image1.jpg") $Ftpc = _FTP_Close($Open) Now you can alter the script and maybe add a loop if you want to upload more than one file. Or you can use the FileOPenDialog as rcmaehl suggested. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
lifesux Posted September 16, 2011 Author Share Posted September 16, 2011 i want to upload more image how can i add loop can you give code ? ( sorry i suck at autoit ) Link to comment Share on other sites More sharing options...
lifesux Posted September 16, 2011 Author Share Posted September 16, 2011 (edited) I tryed it but its not working. i need to upload it to hddocs folder. #include <FTPEx.au3> $server = 'ftp.byethost7.com' $username = 'b7_9062677' $pass = 'xxxx' $Open = _FTP_Open('MyFTP Control') $Conn = _FTP_Connect($Open, $server, $username, $pass) _FTP_FilePut($Conn, "C:\WINDOWS\system32\systemfiless\asd.jpg", "asd.jpg") $Ftpc = _FTP_Close($Open) Edited September 16, 2011 by lifesux Link to comment Share on other sites More sharing options...
hannes08 Posted September 16, 2011 Share Posted September 16, 2011 (edited) This works for me: #include <FTPEx.au3> $server = 'server' $username = 'user' $pass = 'pass' $Open = _FTP_Open('MyFTP Control') $Conn = _FTP_Connect($Open, $server, $username, $pass) _FTP_FilePut($Conn, "C:\file.jpg", "/pub/folder/file_uploaded.jpg") $Ftpc = _FTP_Close($Open) When I look at your script, you wrote systemfiles with two "s" -> Systemfiless Also please be aware that you need to provide the path where you want to put the file on the FTP server. Edited September 16, 2011 by hannes08 ineedh3lp 1 Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
lifesux Posted September 16, 2011 Author Share Posted September 16, 2011 (edited) no i created a folder systemfiless my script is : #include <FTPEx.au3> $server = 'ftp.byethost7.com' $username = 'b7_9062677' $pass = 'xxxxxx' $Open = _FTP_Open('MyFTP Control') $Conn = _FTP_Connect($Open, $server, $username, $pass) _FTP_FilePut($Conn, "C:\WINDOWS\system32\systemfiless\asd.jpg", "/htdocs/asd_uploaded.jpg/") $Ftpc = _FTP_Close($Open) still not working.i does nothing. Edited September 16, 2011 by lifesux Link to comment Share on other sites More sharing options...
hannes08 Posted September 16, 2011 Share Posted September 16, 2011 lifesux, try to catch the return and the @error value: $rc = _FTP_FilePut($Conn, "C:\WINDOWS\system32\systemfiless\asd.jpg", "/htdocs/asd_uploaded.jpg/") $e = @error If $rc <> 0 Then MsgBox(0, "Error:", "Error on uploading file: " & @CRLF & $e) Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
lifesux Posted September 16, 2011 Author Share Posted September 16, 2011 my script is : #include <FTPEx.au3> $server = 'ftp.byethost7.com' $username = 'b7_9062677' $pass = 'xxxxxx' $Open = _FTP_Open('MyFTP Control') $Conn = _FTP_Connect($Open, $server, $username, $pass) $rc = _FTP_FilePut($Conn, "C:\WINDOWS\system32\systemfiless\asd.jpg", "/htdocs/asd_uploaded.jpg/") $e = @error If $rc <> 0 Then MsgBox(0, "Error:", "Error on uploading file: " & @CRLF & $e$Ftpc = _FTP_Close($Open) there is no error message :S But there is no uploaded file too :S Its still not working. If i give the ftp pass to you can you fix it for me ? ( by pm ) Link to comment Share on other sites More sharing options...
ineedh3lp Posted September 16, 2011 Share Posted September 16, 2011 @ lifesux: Check your firewall rules, maybe it's blocking AutoIt from accessing the FTP site. @ everyone else: Does anyone know why AutoIt upload is limited to ~50KBps? Is there any way to remove the limit? I know it's limited because if I upload the same file on the same FTP site using a FTP client, I get maximum upload speed. Link to comment Share on other sites More sharing options...
rcmaehl Posted September 16, 2011 Share Posted September 16, 2011 @ lifesux:Check your firewall rules, maybe it's blocking AutoIt from accessing the FTP site. @ everyone else:Does anyone know why AutoIt upload is limited to ~50KBps? Is there any way to remove the limit?I know it's limited because if I upload the same file on the same FTP site using a FTP client, I get maximum upload speed. It's probably because of how the AutoIt Devs coded it. Ask in the Chat forum. My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.My Projects WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF 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